mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: failing tests for 409
This commit is contained in:
		
							parent
							
								
									31b1457067
								
							
						
					
					
						commit
						0204a52d9b
					
				@ -72,7 +72,7 @@ test('should not be allowed reuse context field name', t => {
 | 
				
			|||||||
        .post(`${base}/api/admin/context/validate`)
 | 
					        .post(`${base}/api/admin/context/validate`)
 | 
				
			||||||
        .send({ name: 'environment' })
 | 
					        .send({ name: 'environment' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test('should create a context field', t => {
 | 
					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`)
 | 
					        .post(`${base}/api/admin/context`)
 | 
				
			||||||
        .send({ name: 'userId', description: 'Bla bla' })
 | 
					        .send({ name: 'userId', description: 'Bla bla' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test('should not create a context field with duplicate legal values', t => {
 | 
					test('should not create a context field with duplicate legal values', t => {
 | 
				
			||||||
 | 
				
			|||||||
@ -131,7 +131,7 @@ test('should not be allowed to reuse active toggle name', t => {
 | 
				
			|||||||
        .post(`${base}/api/admin/features/validate`)
 | 
					        .post(`${base}/api/admin/features/validate`)
 | 
				
			||||||
        .send({ name: 'ts' })
 | 
					        .send({ name: 'ts' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400)
 | 
					        .expect(409)
 | 
				
			||||||
        .expect(res => {
 | 
					        .expect(res => {
 | 
				
			||||||
            t.true(
 | 
					            t.true(
 | 
				
			||||||
                res.body.details[0].message ===
 | 
					                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`)
 | 
					        .post(`${base}/api/admin/features/validate`)
 | 
				
			||||||
        .send({ name: 'ts.archived' })
 | 
					        .send({ name: 'ts.archived' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400)
 | 
					        .expect(409)
 | 
				
			||||||
        .expect(res => {
 | 
					        .expect(res => {
 | 
				
			||||||
            t.true(
 | 
					            t.true(
 | 
				
			||||||
                res.body.details[0].message ===
 | 
					                res.body.details[0].message ===
 | 
				
			||||||
 | 
				
			|||||||
@ -100,7 +100,7 @@ test('not be possible to override name', t => {
 | 
				
			|||||||
    return request
 | 
					    return request
 | 
				
			||||||
        .post(`${base}/api/admin/strategies`)
 | 
					        .post(`${base}/api/admin/strategies`)
 | 
				
			||||||
        .send({ name: 'Testing', parameters: [] })
 | 
					        .send({ name: 'Testing', parameters: [] })
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test('update strategy', t => {
 | 
					test('update strategy', t => {
 | 
				
			||||||
 | 
				
			|||||||
@ -103,7 +103,7 @@ test.serial(
 | 
				
			|||||||
            .post('/api/admin/context')
 | 
					            .post('/api/admin/context')
 | 
				
			||||||
            .send({ name: 'userId' })
 | 
					            .send({ name: 'userId' })
 | 
				
			||||||
            .set('Content-Type', 'application/json')
 | 
					            .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')
 | 
					        .post('/api/admin/context/validate')
 | 
				
			||||||
        .send({ name: 'environment' })
 | 
					        .send({ name: 'environment' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test.serial('should validate name to not ok for non url-friendly', async t => {
 | 
					test.serial('should validate name to not ok for non url-friendly', async t => {
 | 
				
			||||||
 | 
				
			|||||||
@ -174,7 +174,7 @@ test.serial('refuses to create a feature with an existing name', async t => {
 | 
				
			|||||||
        .post('/api/admin/features')
 | 
					        .post('/api/admin/features')
 | 
				
			||||||
        .send({ name: 'featureX' })
 | 
					        .send({ name: 'featureX' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test.serial('refuses to validate a feature with an existing name', async t => {
 | 
					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')
 | 
					        .post('/api/admin/features/validate')
 | 
				
			||||||
        .send({ name: 'featureX' })
 | 
					        .send({ name: 'featureX' })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test.serial(
 | 
					test.serial(
 | 
				
			||||||
@ -221,7 +221,7 @@ test.serial('should not be possible to create archived toggle', async t => {
 | 
				
			|||||||
            strategies: [{ name: 'default' }],
 | 
					            strategies: [{ name: 'default' }],
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test.serial('creates new feature toggle with variant overrides', async t => {
 | 
					test.serial('creates new feature toggle with variant overrides', async t => {
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,7 @@ test.serial('refuses to create a strategy with an existing name', async t => {
 | 
				
			|||||||
        .post('/api/admin/strategies')
 | 
					        .post('/api/admin/strategies')
 | 
				
			||||||
        .send({ name: 'default', parameters: [] })
 | 
					        .send({ name: 'default', parameters: [] })
 | 
				
			||||||
        .set('Content-Type', 'application/json')
 | 
					        .set('Content-Type', 'application/json')
 | 
				
			||||||
        .expect(400);
 | 
					        .expect(409);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test.serial('deletes a new strategy', async t => {
 | 
					test.serial('deletes a new strategy', async t => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user