feat: preserve normalized accepted game facts
This commit is contained in:
1 parent
e6e434d13f
commit
f3286e7fd1
4 files changed
+92
-32
No files matched your search
@@ -62,6 +62,9 @@ describe('Competition persistence schemas', () => {
|
||||
});
|
||||
|
||||
it('makes fact ordering and command replay identities unique', () => {
|
||||
expect(CompetitionFactSchema.path('startedAt')).toBeDefined();
|
||||
expect(CompetitionFactSchema.path('durationSeconds')).toBeDefined();
|
||||
expect(CompetitionFactSchema.path('participants')).toBeDefined();
|
||||
expectIndexes(CompetitionFactSchema, [
|
||||
{
|
||||
keys: { competitionId: 1, revision: 1, ordinalWithinRevision: 1 },
|
||||
@@ -115,7 +118,9 @@ describe('Competition persistence schemas', () => {
|
||||
});
|
||||
|
||||
function expectIndexes(
|
||||
schema: { indexes(): Array<[Record<string, number>, Record<string, unknown>]> },
|
||||
schema: {
|
||||
indexes(): Array<[Record<string, number>, Record<string, unknown>]>;
|
||||
},
|
||||
expected: Array<{
|
||||
keys: Record<string, number>;
|
||||
options?: Record<string, unknown>;
|
||||
@@ -125,10 +130,7 @@ function expectIndexes(
|
||||
for (const candidate of expected) {
|
||||
expect(indexes).toEqual(
|
||||
expect.arrayContaining([
|
||||
[
|
||||
candidate.keys,
|
||||
expect.objectContaining(candidate.options ?? {}),
|
||||
],
|
||||
[candidate.keys, expect.objectContaining(candidate.options ?? {})],
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user