Skip to content

Commit 2537d89

Browse files
committed
Use async/await in tests
towards #1048
1 parent 234544d commit 2537d89

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

tests/index_tests.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ describe.each([
9191

9292
test(`${permission} key: Get raw index that exists`, async () => {
9393
await client.createIndex(indexPk.uid)
94-
await client.getRawIndex(indexPk.uid).then((response) => {
95-
expect(response).toHaveProperty('uid', indexPk.uid)
96-
})
94+
const response = await client.getRawIndex(indexPk.uid)
95+
expect(response).toHaveProperty('uid', indexPk.uid)
9796
})
9897

9998
test(`${permission} key: Get index that does not exist`, async () => {
@@ -124,10 +123,9 @@ describe.each([
124123
await client.createIndex(indexPk.uid, {
125124
primaryKey: indexPk.primaryKey,
126125
})
127-
await client.getRawIndex(indexPk.uid).then((response: IndexResponse) => {
128-
expect(response).toHaveProperty('uid', indexPk.uid)
129-
expect(response).toHaveProperty('primaryKey', indexPk.primaryKey)
130-
})
126+
const response = await client.getRawIndex(indexPk.uid)
127+
expect(response).toHaveProperty('uid', indexPk.uid)
128+
expect(response).toHaveProperty('primaryKey', indexPk.primaryKey)
131129
})
132130

133131
test(`${permission} key: Get index info with NO primary key`, async () => {
@@ -140,10 +138,9 @@ describe.each([
140138

141139
test(`${permission} key: Get raw index info with NO primary key`, async () => {
142140
await client.createIndex(indexNoPk.uid)
143-
await client.getRawIndex(indexNoPk.uid).then((response: IndexResponse) => {
144-
expect(response).toHaveProperty('uid', indexNoPk.uid)
145-
expect(response).toHaveProperty('primaryKey', null)
146-
})
141+
const response = await client.getRawIndex(indexNoPk.uid)
142+
expect(response).toHaveProperty('uid', indexNoPk.uid)
143+
expect(response).toHaveProperty('primaryKey', null)
147144
})
148145

149146
test(`${permission} key: fetch index with primary key`, async () => {

0 commit comments

Comments
 (0)