1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

fix: make jest wait for the promise

This commit is contained in:
Ivar Conradi Østhus 2021-10-07 13:46:33 +02:00
parent 844d6e0f44
commit 7a91c5aaa1
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09

View File

@ -102,7 +102,7 @@ afterAll(async () => {
}); });
test('returns four feature toggles', async () => { test('returns four feature toggles', async () => {
app.request return app.request
.get('/api/client/features') .get('/api/client/features')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
@ -111,19 +111,18 @@ test('returns four feature toggles', async () => {
}); });
}); });
test('returns four feature toggles without createdAt', async () => test('returns four feature toggles without createdAt', async () => {
app.request return app.request
.get('/api/client/features') .get('/api/client/features')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.expect((res) => { .expect((res) => {
expect(res.body.features).toHaveLength(4); expect(res.body.features).toHaveLength(4);
expect(res.body.features[0].createdAt).toBeFalsy(); expect(res.body.features[0].createdAt).toBeFalsy();
})); });
});
test('gets a feature by name', async () => { test('gets a feature by name', async () => {
expect.assertions(0);
return app.request return app.request
.get('/api/client/features/featureX') .get('/api/client/features/featureX')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
@ -131,8 +130,6 @@ test('gets a feature by name', async () => {
}); });
test('cant get feature that does not exist', async () => { test('cant get feature that does not exist', async () => {
expect.assertions(0);
return app.request return app.request
.get('/api/client/features/myfeature') .get('/api/client/features/myfeature')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
@ -140,8 +137,6 @@ test('cant get feature that does not exist', async () => {
}); });
test('Can filter features by namePrefix', async () => { test('Can filter features by namePrefix', async () => {
expect.assertions(2);
return app.request return app.request
.get('/api/client/features?namePrefix=feature.') .get('/api/client/features?namePrefix=feature.')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)