mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
Make single project endpoint also return all features favorites (#2578)
Small update, that single project endpoint would also return features with favorites.
This commit is contained in:
parent
60c9718b8d
commit
24fee65f7e
@ -403,10 +403,8 @@ export default class ProjectFeaturesController extends Controller {
|
||||
res: Response<FeaturesSchema>,
|
||||
): Promise<void> {
|
||||
const { projectId } = req.params;
|
||||
const { user } = req;
|
||||
const features = await this.featureService.getFeatureOverview({
|
||||
projectId,
|
||||
userId: user.id,
|
||||
});
|
||||
this.openApiService.respondWithValidation(
|
||||
200,
|
||||
|
@ -72,6 +72,7 @@ export default class ProjectHealthService {
|
||||
const features = await this.featureToggleService.getFeatureOverview({
|
||||
projectId,
|
||||
archived,
|
||||
userId,
|
||||
});
|
||||
const members = await this.projectStore.getMembersCountByProject(
|
||||
projectId,
|
||||
|
@ -111,16 +111,21 @@ test('should be favorited in project endpoint', async () => {
|
||||
const featureName = 'test-feature';
|
||||
await createFeature(featureName);
|
||||
await favoriteFeature(featureName);
|
||||
await favoriteProject();
|
||||
|
||||
const { body } = await app.request
|
||||
.get(`/api/admin/projects/default/features`)
|
||||
.get(`/api/admin/projects/default`)
|
||||
.set('Content-Type', 'application/json')
|
||||
.expect(200);
|
||||
|
||||
expect(body.features).toHaveLength(1);
|
||||
expect(body.features[0]).toMatchObject({
|
||||
name: featureName,
|
||||
expect(body).toMatchObject({
|
||||
favorite: true,
|
||||
features: [
|
||||
{
|
||||
name: featureName,
|
||||
favorite: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@ -129,12 +134,11 @@ test('feature should not be favorited by default', async () => {
|
||||
await createFeature(featureName);
|
||||
|
||||
const { body } = await app.request
|
||||
.get(`/api/admin/projects/default/features`)
|
||||
.get(`/api/admin/projects/default/features/${featureName}`)
|
||||
.set('Content-Type', 'application/json')
|
||||
.expect(200);
|
||||
|
||||
expect(body.features).toHaveLength(1);
|
||||
expect(body.features[0]).toMatchObject({
|
||||
expect(body).toMatchObject({
|
||||
name: featureName,
|
||||
favorite: false,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user