Skip to content

Commit

Permalink
test: Verify patch for @cosmjs/math
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Jun 27, 2024
1 parent 1fdf25c commit 0fdf898
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/agoric-cli/test/bundle-cosmjs-math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Decimal } from '@cosmjs/math';
18 changes: 18 additions & 0 deletions packages/agoric-cli/test/bundle-cosmjs-math.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A test to verify that importing @cosmsjs/math into an ESM via bundleSource
// can see the exported Decimal constructor, which was at time of writing obscured
// by https://github.com/endojs/endo/pull/2330, temporarily mitigated by a patch.
// Placed here only because Agoric CLI depends on both bundleSource and CosmJS math.

import test from '@endo/ses-ava/prepare-endo.js';
import url from 'url';
import bundleSource from '@endo/bundle-source';
import { importBundle } from '@endo/import-bundle';

test('bundled @comjs/math exports Decimal', async t => {
const entryPath = url.fileURLToPath(
new URL('bundle-cosmjs-math.js', import.meta.url),
);
const bundle = await bundleSource(entryPath);
const ns = await importBundle(bundle);
t.not(ns.Decimal === undefined);
});
2 changes: 2 additions & 0 deletions packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
"@agoric/cosmos": "^0.34.1",
"@ava/typescript": "^4.1.0",
"@cosmology/telescope": "^1.7.1",
"@endo/bundle-source": "^3.2.3",
"@endo/import-bundle": "^1.1.2",
"ava": "^5.3.1",
"rimraf": "^5.0.0",
"tsd": "^0.30.7",
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-proto/test/bundle-cosmjs-math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Decimal } from '@cosmjs/math';
18 changes: 18 additions & 0 deletions packages/cosmic-proto/test/bundle-cosmjs-math.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A test to verify that importing @cosmsjs/math into an ESM via bundleSource
// can see the exported Decimal constructor, which was at time of writing obscured
// by https://github.com/endojs/endo/pull/2330, temporarily mitigated by a patch.
// Placed here only because Agoric CLI depends on both bundleSource and CosmJS math.

import test from '@endo/ses-ava/prepare-endo.js';
import url from 'url';
import bundleSource from '@endo/bundle-source';
import { importBundle } from '@endo/import-bundle';

test('bundled @comjs/math exports Decimal', async t => {
const entryPath = url.fileURLToPath(
new URL('bundle-cosmjs-math.js', import.meta.url),
);
const bundle = await bundleSource(entryPath);
const ns = await importBundle(bundle);
t.not(ns.Decimal, undefined);
});

0 comments on commit 0fdf898

Please sign in to comment.