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(
|
||||
(colorId) =>
|
||||
entitiesByColorId.get(colorId) ||
|
||||
entitiesByColorId.get(String(colorId)) ||
|
||||
new Error(`could not find translation for species ${colorId}`)
|
||||
);
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ const buildSpeciesTranslationLoader = (db) =>
|
|||
|
||||
return speciesIds.map(
|
||||
(speciesId) =>
|
||||
entitiesBySpeciesId.get(speciesId) ||
|
||||
entitiesBySpeciesId.get(String(speciesId)) ||
|
||||
new Error(`could not find translation for species ${speciesId}`)
|
||||
);
|
||||
});
|
||||
|
|
|
@ -9,9 +9,11 @@ describe("Pet", () => {
|
|||
petOnNeopetsDotCom(petName: "roopal27") {
|
||||
species {
|
||||
id
|
||||
name
|
||||
}
|
||||
color {
|
||||
id
|
||||
name
|
||||
}
|
||||
pose
|
||||
items {
|
||||
|
@ -24,6 +26,23 @@ describe("Pet", () => {
|
|||
|
||||
expect(res).toHaveNoErrors();
|
||||
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 {
|
||||
"color": Object {
|
||||
"id": "75",
|
||||
"name": "Starry",
|
||||
},
|
||||
"items": Array [
|
||||
Object {
|
||||
|
@ -35,6 +36,7 @@ Object {
|
|||
"pose": "SAD_MASC",
|
||||
"species": Object {
|
||||
"id": "54",
|
||||
"name": "Zafara",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue