1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-22 01:16:07 +02:00
unleash.unleash/src/lib/openapi/spec/project-status-schema.test.ts
Thomas Heartman 1897f8a19d
chore: add connected environments to project status payload (#8645)
This PR adds connected environments to the project status payload.

It's done by:
- adding a new `getConnectedEnvironmentCountForProject` method to the
project store (I opted for this approach instead of creating a new view
model because it already has a `getEnvironmentsForProject` method)
- adding the project store to the project status service
- updating the schema

For the schema, I opted for adding a `resources` property, under which I
put `connectedEnvironments`. My thinking was that if we want to add the
rest of the project resources (that go in the resources widget), it'd
make sense to group those together inside an object. However, I'd also
be happy to place the property on the top level. If you have opinions
one way or the other, let me know.

As for the count, we're currently only counting environments that have
metrics and that are active for the current project.
2024-11-05 11:12:08 +01:00

17 lines
495 B
TypeScript

import { validateSchema } from '../validate';
import type { ProjectStatusSchema } from './project-status-schema';
test('projectStatusSchema', () => {
const data: ProjectStatusSchema = {
activityCountByDate: [
{ date: '2022-12-14', count: 2 },
{ date: '2022-12-15', count: 5 },
],
resources: { connectedEnvironments: 2 },
};
expect(
validateSchema('#/components/schemas/projectStatusSchema', data),
).toBeUndefined();
});