Skip to content

Commit

Permalink
fix: make reorder tolerant
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 1, 2023
1 parent 5839b0a commit 9f69167
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,9 @@ test('agoricName invitation source errors', async t => {
}),
{
message:
'{"instancePath":["psm-IST-AUSD"],"source":"agoricContract"} - Must have missing properties ["callPipe"]',
// TODO The pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/\{("instancePath":\["psm-IST-AUSD"\]|,|"source":"agoricContract")*\} - Must have missing properties \["callPipe"\]/,
},
);
t.is(await E.get(getBalanceFor(anchor.brand)).value, 0n);
Expand Down
8 changes: 6 additions & 2 deletions packages/zoe/test/unitTests/test-cleanProposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ test('cleanProposal - other wrong stuff', t => {
t,
{ exit: { afterDeadline: 'foo' } },
'nat',
/"foo" - Must be a copyRecord to match a copyRecord pattern: \{"deadline":.*,"timer":.*\}/,
// TODO The outer pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/"foo" - Must be a copyRecord to match a copyRecord pattern: \{("deadline":.*|,|"timer":.*)*\}/,
);
proposeBad(
t,
Expand All @@ -249,7 +251,9 @@ test('cleanProposal - other wrong stuff', t => {
t,
{ exit: { afterDeadline: { timer, deadline: 3n, extra: 'foo' } } },
'nat',
'proposal: exit: afterDeadline?: {"deadline":"[3n]","extra":"foo","timer":"[Alleged: ManualTimer]"} - Must not have unexpected properties: ["extra"]',
// TODO The pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/proposal: exit: afterDeadline\?: \{("deadline":"\[3n\]"|,|"extra":"foo"|,|"timer":"\[Alleged: ManualTimer\]")*\} - Must not have unexpected properties: \["extra"\]/,
);
proposeBad(
t,
Expand Down
12 changes: 8 additions & 4 deletions packages/zoe/test/unitTests/test-testHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ test('assertAmountsEqual - Nat vs. Set', async t => {
harden({ brand: shinyAmount.brand, value: 0n }),
);
const message =
'Asset kinds must match: got [{"description":"hat","name":"hat","power":"shiny"}], expected "[0n]"';
t.is(fakeT.getError(), message);
// TODO The pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/Asset kinds must match: got \[\{("description":"hat"|,|"name":"hat"|,|"power":"shiny")*\}\], expected "\[0n\]"/;
t.assert(message.test(fakeT.getError()));
await t.throwsAsync(resultP, { message });
});

Expand All @@ -87,8 +89,10 @@ test('assertAmountsEqual - false Set', async t => {
const fakeT = makeFakeT();
const resultP = assertAmountsEqual(fakeT, shinyAmount, sparklyAmount);
const message =
'Values must match: got [{"description":"hat","name":"hat","power":"shiny"}], expected [{"description":"hat","name":"hat","power":"sparkly"}]';
t.is(fakeT.getError(), message);
// TODO The pattern is here only as a temporary measure to tolerate
// the property order being sorted and not.
/Values must match: got \[\{("description":"hat"|,|"name":"hat"|,|"power":"shiny")*\}\], expected \[\{("description":"hat"|,|"name":"hat"|,|"power":"sparkly)*"\}\]/;
t.assert(message.test(fakeT.getError()));
await t.throwsAsync(resultP, { message });
});

Expand Down

0 comments on commit 9f69167

Please sign in to comment.