From 0204a52d9b43acc76379382dc8064cc14d9832e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Fri, 25 Sep 2020 22:31:35 +0200 Subject: [PATCH] fix: failing tests for 409 --- lib/routes/admin-api/context.test.js | 4 ++-- lib/routes/admin-api/feature.test.js | 4 ++-- lib/routes/admin-api/strategy.test.js | 2 +- test/e2e/api/admin/context.e2e.test.js | 4 ++-- test/e2e/api/admin/feature.e2e.test.js | 6 +++--- test/e2e/api/admin/strategy.e2e.test.js | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/routes/admin-api/context.test.js b/lib/routes/admin-api/context.test.js index 98ec5b3648..e0da304bab 100644 --- a/lib/routes/admin-api/context.test.js +++ b/lib/routes/admin-api/context.test.js @@ -72,7 +72,7 @@ test('should not be allowed reuse context field name', t => { .post(`${base}/api/admin/context/validate`) .send({ name: 'environment' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test('should create a context field', t => { @@ -120,7 +120,7 @@ test('should not create a context field with existing name', t => { .post(`${base}/api/admin/context`) .send({ name: 'userId', description: 'Bla bla' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test('should not create a context field with duplicate legal values', t => { diff --git a/lib/routes/admin-api/feature.test.js b/lib/routes/admin-api/feature.test.js index c913a24108..5a516539a2 100644 --- a/lib/routes/admin-api/feature.test.js +++ b/lib/routes/admin-api/feature.test.js @@ -131,7 +131,7 @@ test('should not be allowed to reuse active toggle name', t => { .post(`${base}/api/admin/features/validate`) .send({ name: 'ts' }) .set('Content-Type', 'application/json') - .expect(400) + .expect(409) .expect(res => { t.true( res.body.details[0].message === @@ -152,7 +152,7 @@ test('should not be allowed to reuse archived toggle name', t => { .post(`${base}/api/admin/features/validate`) .send({ name: 'ts.archived' }) .set('Content-Type', 'application/json') - .expect(400) + .expect(409) .expect(res => { t.true( res.body.details[0].message === diff --git a/lib/routes/admin-api/strategy.test.js b/lib/routes/admin-api/strategy.test.js index d67f964325..59cc157cc1 100644 --- a/lib/routes/admin-api/strategy.test.js +++ b/lib/routes/admin-api/strategy.test.js @@ -100,7 +100,7 @@ test('not be possible to override name', t => { return request .post(`${base}/api/admin/strategies`) .send({ name: 'Testing', parameters: [] }) - .expect(400); + .expect(409); }); test('update strategy', t => { diff --git a/test/e2e/api/admin/context.e2e.test.js b/test/e2e/api/admin/context.e2e.test.js index 8a9648bb16..bf8fc0a9d8 100644 --- a/test/e2e/api/admin/context.e2e.test.js +++ b/test/e2e/api/admin/context.e2e.test.js @@ -103,7 +103,7 @@ test.serial( .post('/api/admin/context') .send({ name: 'userId' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }, ); @@ -140,7 +140,7 @@ test.serial('should validate name to not ok', async t => { .post('/api/admin/context/validate') .send({ name: 'environment' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test.serial('should validate name to not ok for non url-friendly', async t => { diff --git a/test/e2e/api/admin/feature.e2e.test.js b/test/e2e/api/admin/feature.e2e.test.js index f9838df773..f74ecf710b 100644 --- a/test/e2e/api/admin/feature.e2e.test.js +++ b/test/e2e/api/admin/feature.e2e.test.js @@ -174,7 +174,7 @@ test.serial('refuses to create a feature with an existing name', async t => { .post('/api/admin/features') .send({ name: 'featureX' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test.serial('refuses to validate a feature with an existing name', async t => { @@ -184,7 +184,7 @@ test.serial('refuses to validate a feature with an existing name', async t => { .post('/api/admin/features/validate') .send({ name: 'featureX' }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test.serial( @@ -221,7 +221,7 @@ test.serial('should not be possible to create archived toggle', async t => { strategies: [{ name: 'default' }], }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test.serial('creates new feature toggle with variant overrides', async t => { diff --git a/test/e2e/api/admin/strategy.e2e.test.js b/test/e2e/api/admin/strategy.e2e.test.js index 077efdb74f..ebd934896e 100644 --- a/test/e2e/api/admin/strategy.e2e.test.js +++ b/test/e2e/api/admin/strategy.e2e.test.js @@ -81,7 +81,7 @@ test.serial('refuses to create a strategy with an existing name', async t => { .post('/api/admin/strategies') .send({ name: 'default', parameters: [] }) .set('Content-Type', 'application/json') - .expect(400); + .expect(409); }); test.serial('deletes a new strategy', async t => {