chore: rectifies test issues
This commit is contained in:
@@ -17,6 +17,15 @@ describe('collections-graphql', () => {
|
||||
const config = await configPromise
|
||||
const url = `${serverURL}${config.routes.api}${config.routes.graphQL}`
|
||||
client = new GraphQLClient(url)
|
||||
|
||||
// Wait for indexes to be created,
|
||||
// as we need them to query by point
|
||||
await new Promise((resolve, reject) => {
|
||||
payload.db.collections.point.ensureIndexes(function (err) {
|
||||
if (err) reject(err)
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -173,12 +182,14 @@ describe('collections-graphql', () => {
|
||||
}
|
||||
}`
|
||||
|
||||
const response = await client.request(query);
|
||||
const { docs } = response.Posts;
|
||||
const docsWithWhereTitleNotEqualPostTitle = docs.filter((post) => post.title === post1.title);
|
||||
const response = await client.request(query)
|
||||
const { docs } = response.Posts
|
||||
const docsWithWhereTitleNotEqualPostTitle = docs.filter(
|
||||
(post) => post.title === post1.title,
|
||||
)
|
||||
|
||||
expect(docsWithWhereTitleNotEqualPostTitle).toHaveLength(0);
|
||||
});
|
||||
expect(docsWithWhereTitleNotEqualPostTitle).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('like', async () => {
|
||||
const postWithWords = await createPost({ title: 'the quick brown fox' })
|
||||
@@ -271,10 +282,10 @@ describe('collections-graphql', () => {
|
||||
}
|
||||
}`
|
||||
|
||||
const response = await client.request(query);
|
||||
const { docs } = response.Posts;
|
||||
expect(docs.map(({ id }) => id)).toContain(numPost2.id);
|
||||
});
|
||||
const response = await client.request(query)
|
||||
const { docs } = response.Posts
|
||||
expect(docs.map(({ id }) => id)).toContain(numPost2.id)
|
||||
})
|
||||
|
||||
it('greater_than_equal', async () => {
|
||||
const query = `query {
|
||||
|
||||
Reference in New Issue
Block a user