mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: seed setup and remove admin/features call (#3567)
## About the changes Seed setup fails because of compilation errors, we need to skip errors until we fix them. Also, this removes one usage of `/api/admin/features` that was used only for testing
This commit is contained in:
		
							parent
							
								
									551c00b6b2
								
							
						
					
					
						commit
						44b19e92ee
					
				| @ -51,7 +51,7 @@ | ||||
|     "test:coverage": "NODE_ENV=test PORT=4243 jest --coverage --testLocationInResults --outputFile=\"coverage/report.json\" --forceExit --testTimeout=10000", | ||||
|     "pretest:coverage:jest": "yarn build:frontend", | ||||
|     "test:coverage:jest": "NODE_ENV=test PORT=4243 jest --silent --ci --json --coverage --testLocationInResults --outputFile=\"report.json\" --forceExit --testTimeout=10000", | ||||
|     "seed:setup": "ts-node src/test/e2e/seed/segment.seed.ts", | ||||
|     "seed:setup": "ts-node --compilerOptions '{\"strictNullChecks\": false}' src/test/e2e/seed/segment.seed.ts", | ||||
|     "seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev", | ||||
|     "clean": "del-cli --force dist", | ||||
|     "preversion": "./scripts/check-release.sh", | ||||
|  | ||||
| @ -33,13 +33,6 @@ const fetchSegments = (app: IUnleashTest): Promise<ISegment[]> => { | ||||
|     return app.services.segmentService.getAll(); | ||||
| }; | ||||
| 
 | ||||
| const fetchFeatures = (app: IUnleashTest): Promise<IFeatureToggleClient[]> => { | ||||
|     return app.request | ||||
|         .get('/api/admin/features') | ||||
|         .expect(200) | ||||
|         .then((res) => res.body.features); | ||||
| }; | ||||
| 
 | ||||
| const createSegment = ( | ||||
|     app: IUnleashTest, | ||||
|     postData: UpsertSegmentSchema, | ||||
| @ -52,11 +45,12 @@ const createFeatureToggle = ( | ||||
|     app: IUnleashTest, | ||||
|     postData: object, | ||||
|     expectStatusCode = 201, | ||||
| ): Promise<unknown> => { | ||||
| ): Promise<IFeatureToggleClient> => { | ||||
|     return app.request | ||||
|         .post('/api/admin/features') | ||||
|         .send(postData) | ||||
|         .expect(expectStatusCode); | ||||
|         .expect(expectStatusCode) | ||||
|         .then((res) => res.body); | ||||
| }; | ||||
| 
 | ||||
| const addSegmentToStrategy = ( | ||||
| @ -116,13 +110,12 @@ const seedSegmentsDatabase = async ( | ||||
|         }), | ||||
|     ); | ||||
| 
 | ||||
|     await Promise.all( | ||||
|         seedFeatures(spec).map((seed) => { | ||||
|     const features = await Promise.all( | ||||
|         seedFeatures(spec).map(async (seed) => { | ||||
|             return createFeatureToggle(app, seed); | ||||
|         }), | ||||
|     ); | ||||
| 
 | ||||
|     const features = await fetchFeatures(app); | ||||
|     const segments = await fetchSegments(app); | ||||
|     assert(features.length === spec.featuresCount); | ||||
|     assert(segments.length === spec.segmentsPerFeature); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user