mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	auto disable, and do not serve archived toggle
This commit is contained in:
		
							parent
							
								
									e0e7d919ef
								
							
						
					
					
						commit
						45c2021bd6
					
				| @ -47,7 +47,7 @@ class FeatureToggleStore { | ||||
|         return this.db | ||||
|             .first(FEATURE_COLUMNS) | ||||
|             .from(TABLE) | ||||
|             .where({ name }) | ||||
|             .where({ name, archived: 0 }) | ||||
|             .then(this.rowToFeature); | ||||
|     } | ||||
| 
 | ||||
| @ -103,10 +103,10 @@ class FeatureToggleStore { | ||||
|     _archiveFeature({ name }) { | ||||
|         return this.db(TABLE) | ||||
|             .where({ name }) | ||||
|             .update({ archived: 1 }) | ||||
|             .catch(err => | ||||
|                 logger.error('Could not archive feature, error was: ', err) | ||||
|             ); | ||||
|             .update({ archived: 1, enabled: 0 }) | ||||
|             .catch(err => { | ||||
|                 logger.error('Could not archive feature, error was: ', err); | ||||
|             }); | ||||
|     } | ||||
| 
 | ||||
|     _reviveFeature({ name }) { | ||||
|  | ||||
| @ -31,6 +31,30 @@ test.serial('revives a feature by name', async t => { | ||||
|         .then(destroy); | ||||
| }); | ||||
| 
 | ||||
| test.serial( | ||||
|     'archived feature is not accessible via /features/:featureName', | ||||
|     async t => { | ||||
|         t.plan(0); | ||||
|         const { request, destroy } = await setupApp('archive_serial2'); | ||||
| 
 | ||||
|         await request | ||||
|             .get('/api/admin/features/featureX') | ||||
|             .set('Content-Type', 'application/json') | ||||
|             .expect(200); | ||||
| 
 | ||||
|         await request | ||||
|             .delete('/api/admin/features/featureX') | ||||
|             .set('Content-Type', 'application/json') | ||||
|             .expect(200); | ||||
| 
 | ||||
|         return request | ||||
|             .get('/api/admin/features/featureX') | ||||
|             .set('Content-Type', 'application/json') | ||||
|             .expect(404) | ||||
|             .then(destroy); | ||||
|     } | ||||
| ); | ||||
| 
 | ||||
| test.serial('must set name when reviving toggle', async t => { | ||||
|     t.plan(0); | ||||
|     const { request, destroy } = await setupApp('archive_serial'); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user