mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-23 13:46:45 +02:00
wip: start updating tests in read model
This commit is contained in:
parent
33a57bc3f3
commit
6efd78c403
@ -133,3 +133,43 @@ describe.each([
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe.each([
|
||||
[
|
||||
'updateStrategy',
|
||||
(segmentId: number) =>
|
||||
updateStrategyInCr(randomId(), segmentId, FLAG_NAME),
|
||||
],
|
||||
[
|
||||
'addStrategy',
|
||||
(segmentId: number) => addStrategyToCr(segmentId, FLAG_NAME),
|
||||
],
|
||||
])(
|
||||
'%s events should show up in used strategies correctly',
|
||||
(_, addOrUpdateStrategy) => {
|
||||
test.each([
|
||||
['Draft', true],
|
||||
['In Review', true],
|
||||
['Scheduled', true],
|
||||
['Approved', true],
|
||||
['Rejected', false],
|
||||
['Cancelled', false],
|
||||
['Applied', false],
|
||||
])(
|
||||
'Changes in %s CRs should make it %s',
|
||||
async (state, expectedOutcome) => {
|
||||
await createCR(state);
|
||||
|
||||
const segmentId = 3;
|
||||
await addOrUpdateStrategy(segmentId);
|
||||
|
||||
expect(readModel).get;
|
||||
expect(
|
||||
await readModel.isSegmentUsedInActiveChangeRequests(
|
||||
segmentId,
|
||||
),
|
||||
).toBe(expectedOutcome);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -1,3 +1,4 @@
|
||||
export interface IChangeRequestSegmentUsageReadModel {
|
||||
isSegmentUsedInActiveChangeRequests(segmentId: number): Promise<boolean>;
|
||||
getSegmentsUsedInActiveChangeRequests(): Promise<{}[]>;
|
||||
}
|
||||
|
@ -523,7 +523,6 @@ describe('detect strategy usage in change requests', () => {
|
||||
});
|
||||
|
||||
// for addStrategy, add strategy to feature with segment
|
||||
// for updateStrategy, add existing strategy, then add segment in CR
|
||||
// check that getStrategies for segments contains the CR strategies
|
||||
|
||||
const segmentStrategies = await fetchSegmentStrategies(segment.id);
|
||||
@ -577,7 +576,6 @@ describe('detect strategy usage in change requests', () => {
|
||||
created_by: user.id,
|
||||
});
|
||||
|
||||
// for addStrategy, add strategy to feature with segment
|
||||
// for updateStrategy, add existing strategy, then add segment in CR
|
||||
// check that getStrategies for segments contains the CR strategies
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user