diff --git a/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js b/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js index 11d12fb790..f310611e7c 100644 --- a/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js +++ b/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js @@ -255,10 +255,18 @@ describe('Test Graphql API End to End', () => { }); expect(res.statusCode).toBe(200); - expect(res.body).toEqual({ - data: { - posts: expected, - }, + + // same length + expect(res.body.data.posts.length).toBe(expected.length); + + // all the posts returned are in the expected array + res.body.data.posts.forEach(post => { + expect(expected).toEqual(expect.arrayContaining([post])); + }); + + // all expected values are in the result + expected.forEach(expectedPost => { + expect(res.body.data.posts).toEqual(expect.arrayContaining([expectedPost])); }); });