fix bug loading species/color translation on pet
This commit is contained in:
parent
ce81543957
commit
caefc6610c
3 changed files with 24 additions and 3 deletions
|
@ -21,7 +21,7 @@ const buildColorTranslationLoader = (db) =>
|
||||||
|
|
||||||
return colorIds.map(
|
return colorIds.map(
|
||||||
(colorId) =>
|
(colorId) =>
|
||||||
entitiesByColorId.get(colorId) ||
|
entitiesByColorId.get(String(colorId)) ||
|
||||||
new Error(`could not find translation for species ${colorId}`)
|
new Error(`could not find translation for species ${colorId}`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -46,7 +46,7 @@ const buildSpeciesTranslationLoader = (db) =>
|
||||||
|
|
||||||
return speciesIds.map(
|
return speciesIds.map(
|
||||||
(speciesId) =>
|
(speciesId) =>
|
||||||
entitiesBySpeciesId.get(speciesId) ||
|
entitiesBySpeciesId.get(String(speciesId)) ||
|
||||||
new Error(`could not find translation for species ${speciesId}`)
|
new Error(`could not find translation for species ${speciesId}`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,9 +9,11 @@ describe("Pet", () => {
|
||||||
petOnNeopetsDotCom(petName: "roopal27") {
|
petOnNeopetsDotCom(petName: "roopal27") {
|
||||||
species {
|
species {
|
||||||
id
|
id
|
||||||
|
name
|
||||||
}
|
}
|
||||||
color {
|
color {
|
||||||
id
|
id
|
||||||
|
name
|
||||||
}
|
}
|
||||||
pose
|
pose
|
||||||
items {
|
items {
|
||||||
|
@ -24,6 +26,23 @@ describe("Pet", () => {
|
||||||
|
|
||||||
expect(res).toHaveNoErrors();
|
expect(res).toHaveNoErrors();
|
||||||
expect(res.data).toMatchSnapshot();
|
expect(res.data).toMatchSnapshot();
|
||||||
expect(getDbCalls()).toMatchInlineSnapshot(`Array []`);
|
expect(getDbCalls()).toMatchInlineSnapshot(`
|
||||||
|
Array [
|
||||||
|
Array [
|
||||||
|
"SELECT * FROM species_translations
|
||||||
|
WHERE species_id IN (?) AND locale = \\"en\\"",
|
||||||
|
Array [
|
||||||
|
54,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
Array [
|
||||||
|
"SELECT * FROM color_translations
|
||||||
|
WHERE color_id IN (?) AND locale = \\"en\\"",
|
||||||
|
Array [
|
||||||
|
75,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@ Object {
|
||||||
"petOnNeopetsDotCom": Object {
|
"petOnNeopetsDotCom": Object {
|
||||||
"color": Object {
|
"color": Object {
|
||||||
"id": "75",
|
"id": "75",
|
||||||
|
"name": "Starry",
|
||||||
},
|
},
|
||||||
"items": Array [
|
"items": Array [
|
||||||
Object {
|
Object {
|
||||||
|
@ -35,6 +36,7 @@ Object {
|
||||||
"pose": "SAD_MASC",
|
"pose": "SAD_MASC",
|
||||||
"species": Object {
|
"species": Object {
|
||||||
"id": "54",
|
"id": "54",
|
||||||
|
"name": "Zafara",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue