Skip to content

Commit

Permalink
fix: update to depend on ses 0.12.5
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Mar 26, 2021
1 parent 85b674e commit 9dea2eb
Show file tree
Hide file tree
Showing 29 changed files with 265 additions and 129 deletions.
44 changes: 18 additions & 26 deletions packages/ERTP/test/unitTests/mathHelpers/test-natMathHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ test('natMathHelpers make', t => {
t.throws(
() => m.make('abc', mockBrand),
{
message: 'value (a string) must be a Nat or an array',
message: /value .* must be a Nat or an array/,
},
`'abc' is not a nat`,
);
t.throws(
() => m.make(-1, mockBrand),
{ message: 'value (a number) must be a Nat or an array' },
{ message: /value .* must be a Nat or an array/ },
`- 1 is not a valid Nat`,
);
});
Expand All @@ -34,7 +34,7 @@ test('natMathHelpers make no brand', t => {
t.throws(
() => m.make(4n),
{
message: "The brand (an undefined) doesn't look like a brand.",
message: /The brand "\[undefined\]" doesn't look like a brand./,
},
`brand is required in make`,
);
Expand Down Expand Up @@ -70,7 +70,7 @@ test('natMathHelpers coerce', t => {
t.throws(
() => m.coerce(3n, mockBrand),
{
message: `The amount (a bigint) doesn't look like an amount. Did you pass a value instead?`,
message: /The amount .* doesn't look like an amount. Did you pass a value instead?/,
},
`coerce needs a brand`,
);
Expand All @@ -81,7 +81,7 @@ test('natMathHelpers coerce no brand', t => {
// @ts-ignore deliberate invalid arguments for testing
() => m.coerce(m.make(4n, mockBrand)),
{
message: "The brand (an undefined) doesn't look like a brand.",
message: /The brand "\[undefined\]" doesn't look like a brand./,
},
`brand is required in coerce`,
);
Expand All @@ -97,7 +97,7 @@ test('natMathHelpers getValue no brand', t => {
// @ts-ignore deliberate invalid arguments for testing
() => m.getValue(m.make(4n, mockBrand)),
{
message: "The brand (an undefined) doesn't look like a brand.",
message: /The brand "\[undefined\]" doesn't look like a brand./,
},
`brand is required in getValue`,
);
Expand All @@ -114,7 +114,7 @@ test('natMathHelpers makeEmpty no brand', t => {
// @ts-ignore deliberate invalid arguments for testing
() => m.makeEmpty(MathKind.NAT),
{
message: "The brand (a string) doesn't look like a brand.",
message: /The brand .* doesn't look like a brand./,
},
`make empty no brand`,
);
Expand All @@ -128,21 +128,21 @@ test('natMathHelpers isEmpty', t => {
t.throws(
() => m.isEmpty('abc'),
{
message: `The amount (a string) doesn't look like an amount. Did you pass a value instead?`,
message: /The amount .* doesn't look like an amount. Did you pass a value instead?/,
},
`isEmpty('abc') throws because it cannot be coerced`,
);
t.throws(
() => m.isEmpty({ brand: mockBrand, value: 'abc' }),
{
message: 'value (a string) must be a Nat or an array',
message: /value .* must be a Nat or an array/,
},
`isEmpty('abc') throws because it cannot be coerced`,
);
t.throws(
() => m.isEmpty(0n),
{
message: `The amount (a bigint) doesn't look like an amount. Did you pass a value instead?`,
message: /The amount .* doesn't look like an amount. Did you pass a value instead?/,
},
`isEmpty(0) throws because it cannot be coerced`,
);
Expand All @@ -161,8 +161,7 @@ test('natMathHelpers isGTE mixed brands', t => {
t.throws(
() => m.isGTE(m.make(5n, Far('otherBrand', {})), m.make(3n, mockBrand)),
{
message:
'Brands in left (an object) and right (an object) should match but do not',
message: /Brands in left .* and right .* should match but do not/,
},
);
});
Expand All @@ -176,8 +175,7 @@ test(`natMathHelpers isGTE - brands don't match objective brand`, t => {
Far('otherBrand', {}),
),
{
message:
"amount's brand (an object) did not match expected brand (an object)",
message: /amount's brand .* did not match expected brand .*/,
},
);
});
Expand All @@ -197,8 +195,7 @@ test('natMathHelpers isEqual mixed brands', t => {
t.throws(
() => m.isEqual(m.make(4n, Far('otherBrand', {})), m.make(4n, mockBrand)),
{
message:
'Brands in left (an object) and right (an object) should match but do not',
message: /Brands in left .* and right .* should match but do not/,
},
);
});
Expand All @@ -212,8 +209,7 @@ test(`natMathHelpers isEqual - brands don't match objective brand`, t => {
Far('otherBrand', {}),
),
{
message:
"amount's brand (an object) did not match expected brand (an object)",
message: /amount's brand .* did not match expected brand .*/,
},
);
});
Expand All @@ -230,8 +226,7 @@ test('natMathHelpers add mixed brands', t => {
t.throws(
() => m.add(m.make(5n, Far('otherBrand', {})), m.make(9n, mockBrand)),
{
message:
'Brands in left (an object) and right (an object) should match but do not',
message: /Brands in left .* and right .* should match but do not/,
},
);
});
Expand All @@ -245,8 +240,7 @@ test(`natMathHelpers add - brands don't match objective brand`, t => {
Far('otherBrand', {}),
),
{
message:
"amount's brand (an object) did not match expected brand (an object)",
message: /amount's brand .* did not match expected brand .*/,
},
);
});
Expand All @@ -263,8 +257,7 @@ test('natMathHelpers subtract mixed brands', t => {
t.throws(
() => m.subtract(m.make(6n, Far('otherBrand', {})), m.make(1n, mockBrand)),
{
message:
'Brands in left (an object) and right (an object) should match but do not',
message: /Brands in left .* and right .* should match but do not/,
},
);
});
Expand All @@ -278,8 +271,7 @@ test(`natMathHelpers subtract brands don't match brand`, t => {
Far('otherBrand', {}),
),
{
message:
"amount's brand (an object) did not match expected brand (an object)",
message: /amount's brand .* did not match expected brand .*/,
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const runSetMathHelpersTests = (t, [a, b, c], a2 = undefined) => {
);
t.throws(
() => m.make('a', mockBrand),
{ message: `value (a string) must be a Nat or an array` },
{ message: /value .* must be a Nat or an array/ },
'strings are not valid',
);
if (a2 !== undefined) {
Expand Down Expand Up @@ -87,7 +87,7 @@ const runSetMathHelpersTests = (t, [a, b, c], a2 = undefined) => {
);
t.throws(
() => m.coerce({ brand: mockBrand, value: 'a' }, mockBrand),
{ message: `value (a string) must be a Nat or an array` },
{ message: /value .* must be a Nat or an array/ },
'strings are not valid',
);
if (a2 !== undefined) {
Expand Down Expand Up @@ -119,7 +119,7 @@ const runSetMathHelpersTests = (t, [a, b, c], a2 = undefined) => {
);
t.throws(
() => m.isEmpty({ brand: mockBrand, value: harden({}) }),
{ message: `value (an object) must be a Nat or an array` },
{ message: /value .* must be a Nat or an array/ },
`m.isEmpty({}) throws`,
);
t.falsy(m.isEmpty(m.make(['abc'], mockBrand)), `m.isEmpty(['abc']) is false`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('set with strings make', t => {
);
t.throws(
() => m.make('abc', mockBrand),
{ message: `value (a string) must be a Nat or an array` },
{ message: /value .* must be a Nat or an array/ },
`'abc' is not a valid string array`,
);
t.throws(
Expand All @@ -42,7 +42,7 @@ test('set with strings coerce', t => {
);
t.throws(
() => m.coerce({ brand: mockBrand, value: '6' }, mockBrand),
{ message: `value (a string) must be a Nat or an array` },
{ message: /value .* must be a Nat or an array/ },
`'6' is not a valid array`,
);
t.throws(
Expand Down Expand Up @@ -71,7 +71,7 @@ test('set with strings makeEmpty', t => {
);
t.throws(
() => m.isEmpty({ brand: mockBrand, value: ['a', 'a'] }),
{ message: `value has duplicates: (a string) and (a string)` },
{ message: /value has duplicates: .* and .*/ },
`duplicates in isEmpty throw`,
);
});
Expand Down Expand Up @@ -185,7 +185,7 @@ test('set with strings add', t => {
{ brand: mockBrand, value: ['a'] },
{ brand: mockBrand, value: ['a'] },
),
{ message: `value has duplicates: (a string) and (a string)` },
{ message: /value has duplicates: .* and .*/ },
`overlap between left and right of add should throw`,
);
t.deepEqual(
Expand Down Expand Up @@ -231,7 +231,7 @@ test('set with strings subtract', t => {
{ brand: mockBrand, value: ['a', 'b'] },
{ brand: mockBrand, value: ['c'] },
),
{ message: `right element (a string) was not in left` },
{ message: /right element .* was not in left/ },
`elements in right but not in left of subtract should throw`,
);
t.deepEqual(
Expand Down
17 changes: 15 additions & 2 deletions packages/ERTP/test/unitTests/test-issuerObj.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ test('bad display info', t => {
// @ts-ignore deliberate invalid arguments for testing
t.throws(() => makeIssuerKit('fungible', MathKind.NAT, displayInfo), {
message:
'key "somethingUnexpected" was not one of the expected keys ["decimalPlaces"]',
// Should be able to use more informative error once SES double
// disclosure bug is fixed. See
// https://github.com/endojs/endo/pull/640
//
// /key "somethingUnexpected" was not one of the expected keys \["decimalPlaces"\]/,
/key .* was not one of the expected keys .*/,
});
});

Expand Down Expand Up @@ -415,7 +420,15 @@ test('issuer.combine bad payments', async t => {

await t.throwsAsync(
() => E(issuer).combine(payments),
{ message: /"payment" not found/ },
{
message:
// Should be able to use more informative error once SES double
// disclosure bug is fixed. See
// https://github.com/endojs/endo/pull/640
//
// /"payment" not found/
/.* not found/,
},
'payment from other mint is not found',
);
});
2 changes: 1 addition & 1 deletion packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"rollup": "^1.23.1",
"rollup-plugin-node-resolve": "^5.2.0",
"semver": "^6.3.0",
"ses": "^0.12.3",
"ses": "^0.12.5",
"yargs": "^14.2.0"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"access": "public"
},
"dependencies": {
"ses": "^0.12.3"
"ses": "^0.12.5"
}
}
14 changes: 11 additions & 3 deletions packages/dapp-svelte-wallet/api/test/test-lib-dehydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ test('makeDehydrator', async t => {
instanceHandleMapping.addPetname('atomicSwap', handle2);
instanceHandleMapping.addPetname('automaticRefund', handle3);
t.throws(() => instanceHandleMapping.addPetname('simpleExchange2', handle1), {
message: /val \(an object\) already has a petname/,
message: /val .* already has a petname/,
});
t.throws(
() =>
instanceHandleMapping.addPetname(
'simpleExchange',
Far('simpleExchangeHandle'),
),
{ message: /petname \(a string\) is already in use/ },
{ message: /petname .* is already in use/ },
);

// Test renaming.
Expand Down Expand Up @@ -77,7 +77,15 @@ test('makeDehydrator', async t => {
instanceHandleMapping.deletePetname('to be deleted');
t.throws(
() => instanceHandleMapping.petnameToVal.get('to be deleted'),
{ message: /"petname" not found/ },
{
message:
// Should be able to use more informative error once SES double
// disclosure bug is fixed. See
// https://github.com/endojs/endo/pull/640
//
// /"petname" not found/
/.* not found/,
},
`can't get what has been deleted`,
);

Expand Down
10 changes: 9 additions & 1 deletion packages/dapp-svelte-wallet/api/test/test-lib-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,15 @@ test('lib-wallet dapp suggests issuer, instance, installation petnames', async t

t.throws(
() => wallet.getInstallation('whatever'),
{ message: /"petname" not found/ },
{
message:
// Should be able to use more informative error once SES double
// disclosure bug is fixed. See
// https://github.com/endojs/endo/pull/640
//
// /"petname" not found/
/.* not found/,
},
`using a petname that doesn't exist errors`,
);

Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-svelte-wallet/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^6.1.0",
"ses": "^0.12.3",
"ses": "^0.12.5",
"sirv-cli": "^1.0.0",
"smelte": "^1.0.15",
"svelte": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ test('assertOfferResult', async t => {
};
await t.notThrowsAsync(() => assertOfferResult(mockSeat, 'result'));
await t.throwsAsync(() => assertOfferResult(mockSeat, 'not result'), {
message: 'offerResult ((a string)) did not equal expected: (a string)',
message: /offerResult (.*) did not equal expected: .*/,
});
});
2 changes: 1 addition & 1 deletion packages/install-ses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@agoric/eventual-send": "^0.13.4",
"ses": "^0.12.3"
"ses": "^0.12.5"
},
"files": [
"src/**/*.js"
Expand Down
8 changes: 4 additions & 4 deletions packages/spawner/test/swingsetTests/escrow/test-escrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test.skip('escrow checkUnits w/SES', async t => {

const escrowMismatchGolden = [
'starting testEscrowServiceCheckMismatches',
'expected unsuccessful check Error: Escrow checkUnits: different at top.right.value: ((a string)) vs ((a string))',
/expected unsuccessful check Error: Escrow checkUnits: different at top.right.value: (.*) vs (.*)/,
];

test.skip('escrow check misMatches w/SES', async t => {
Expand All @@ -31,7 +31,7 @@ test.skip('escrow check misMatches w/SES', async t => {

const escrowCheckPartialWrongPriceGolden = [
'starting testEscrowServiceCheckPartial wrong price',
'expected wrong price Error: Escrow checkPartialUnits seat: different at top.value: ((a number)) vs ((a number))',
/expected wrong price Error: Escrow checkPartialUnits seat: different at top.value: (.*) vs (.*)/,
];

test.skip('escrow check partial price misMatches w/SES', async t => {
Expand All @@ -41,7 +41,7 @@ test.skip('escrow check partial price misMatches w/SES', async t => {

const escrowCheckPartialWrongStockGolden = [
'starting testEscrowServiceCheckPartial wrong stock',
'expected wrong stock Error: Escrow checkPartialUnits seat: different at top.value: ((a string)) vs ((a string))',
/expected wrong stock Error: Escrow checkPartialUnits seat: different at top.value: (.*) vs (.*)/,
];

test.skip('escrow check partial stock misMatches w/SES', async t => {
Expand All @@ -51,7 +51,7 @@ test.skip('escrow check partial stock misMatches w/SES', async t => {

const escrowCheckPartialWrongSeatGolden = [
'starting testEscrowServiceCheckPartial wrong seat',
'expected wrong side Error: Escrow checkPartialUnits seat: label not found on right at top: ((an object)) vs ((an object))',
/expected wrong side Error: Escrow checkPartialUnits seat: label not found on right at top: (.*) vs (.*)/,
];

test.skip('escrow check partial wrong seat w/SES', async t => {
Expand Down
Loading

0 comments on commit 9dea2eb

Please sign in to comment.