My issue lies in the mock data generation process where instead of unique data for each item, all items end up having the same field value.
Suggested Solution 1: (ideal approach, incorrect results)
Within the AppSync schema, there is an items
field that contains a list of Model
. If I use the Model
resolver on its own, all the Model
objects within the items
list end up with the same value.
const mocks = {
ModelModelConnection: () => ({
items: () => new MockList(5),
}),
Model: () => ({
id: casual.uuid,
name: casual.title,
}),
};
This setup leads to...
Suggested Solution 2: (alternative method, correct results)
const mocks = {
ModelModelConnection: () => ({
items: () => new MockList(5, () => ({
id: casual.uuid,
name: casual.title,
})),
}),
};
I am inclined towards Option 1, but struggling to achieve unique data while mocking. Any insights or assistance would be greatly appreciated!