Skip to content

Commit

Permalink
test(bundle-source): revert outdated narrowing assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 1, 2023
1 parent 2e546d2 commit 670a02c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions packages/bundle-source/test/sanity.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
import { lockdown } from '@endo/lockdown';

import url from 'url';
Expand Down Expand Up @@ -30,12 +31,12 @@ export function makeSanityTests(stackFiltering) {
url.fileURLToPath(new URL('../demo/dir1/encourage.js', import.meta.url)),
'endoZipBase64',
);
assert(endoZipBase64);

const bytes = decodeBase64(endoZipBase64);
const archive = await parseArchive(bytes);
// Call import by property to bypass SES censoring for dynamic import.
// eslint-disable-next-line dot-notation
const { namespace } = await archive['import']('.');
const { namespace } = await archive['import']();
const { message, encourage } = namespace;

t.is(message, `You're great!`);
Expand Down Expand Up @@ -138,7 +139,8 @@ export function makeSanityTests(stackFiltering) {
const srcMap2 = `(${src2})\n${map2}`;

// eslint-disable-next-line no-eval
const ex2 = (1, eval)(srcMap2)();
const eval2 = eval;
const ex2 = eval2(srcMap2)();
t.is(ex2.message, `You're great!`, 'exported message matches');
t.is(
ex2.encourage('Nick'),
Expand Down Expand Up @@ -171,6 +173,7 @@ export function makeSanityTests(stackFiltering) {
t.truthy(!src1.match(/beforeExpr,;/), 'source is not mangled that one way');
// the mangled form wasn't syntactically valid, do a quick check
// eslint-disable-next-line no-eval
(1, eval)(`(${src1})`);
const eval2 = eval;
eval2(`(${src1})`);
});
}
2 changes: 1 addition & 1 deletion packages/bundle-source/test/test-bigint-transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
import url from 'url';
import { test } from './prepare-test-env-ava.js';
import bundleSource from '../src/index.js';
Expand All @@ -8,6 +9,5 @@ test('bigint transform', async t => {
'getExport',
);
// console.log(bundle.source);
assert(bundle.source);
t.assert(bundle.source.indexOf('37n') >= 0);
});

0 comments on commit 670a02c

Please sign in to comment.