test: Verify Endo support
MODIFY
package.json
package.json
"homepage": "https://github.com/Agoric/nat#readme",
"dependencies": {},
"devDependencies": {
+ "@endo/compartment-mapper": "^0.3.1",
"ava": "^3.15.0",
"eslint": "^7.14.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
- "esm": "^3.2.25",
+ "esm": "agoric-labs/esm#Agoric-built",
"prettier": "^1.19.1",
- "rollup": "^2.34.0"
+ "rollup": "^2.34.0",
+ "ses": "^0.13.1"
},
"directories": {
"test": "test"

ADD
test/test-endo.js
+import 'ses';
+import fs from 'fs';
+import test from 'ava';
+import { importLocation } from '@endo/compartment-mapper';
+
+const entry = new URL('../src/index.js', import.meta.url).toString();
+
+const read = async location => fs.promises.readFile(new URL(location).pathname);
+
+test('endo can import nat', async t => {
+ const {
+ namespace: { isNat },
+ } = await importLocation(read, entry);
+ t.assert(isNat(0n));
+});

test: Verify Endo support