Skip to content

Commit

Permalink
fix: revert broken ones
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jun 30, 2023
1 parent 5b00377 commit 09cabb3
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/fixtures-assets/main.js
Expand Up @@ -19,13 +19,13 @@ if (!(bytes instanceof ArrayBuffer)) {

const expected = [0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x0a];
const numbers = new Uint8Array(bytes);
for (const b, i of (expected)) {
expected.forEach((b, i) => {
if (b !== numbers[i]) {
throw Error(
`Unexpected imported byte ${numbers[i]} at index ${i}, expected ${b}`,
);
}
;}
});

const textForBytes = new TextDecoder().decode(bytes);
if (textForBytes === 'Hello.\n') {
Expand Down
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/test-extension.js
Expand Up @@ -24,7 +24,7 @@ const q = JSON.stringify;
location: 'https://example.com/foo.tar.gz',
extension: 'gz',
},
for (const c of (])) {
].forEach(c => {
test(`parseExtension(${q(c.location)}) -> ${q(c.extension)}`, t => {
t.plan(1);
const extension = parseExtension(c.location);
Expand All @@ -33,5 +33,5 @@ for (const c of (])) {
c.extension,
`parseExtension(${q(c.location)}) === ${q(c.extension)}`,
);
;}
});
});
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/test-infer-exports.js
Expand Up @@ -3,11 +3,11 @@ import { inferExports } from '../src/infer-exports.js';

function scaffold(cases) {
const tags = new Set(['node', 'import', 'default']);
for (const pkg of (cases)) {
cases.forEach(pkg => {
test(`infer-exports for ${pkg.name}`, t => {
const types = {};
const exports = inferExports(pkg, tags, types);
t.snapshot({ types, exports ;}
t.snapshot({ types, exports });
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/test-join.js
Expand Up @@ -13,12 +13,12 @@ const q = JSON.stringify;
},
{ via: '@org/lib', rel: './lib/app.js', res: '@org/lib/lib/app.js' },
{ via: 'external', rel: './internal/../main.js', res: 'external/main.js' },
for (const c of (])) {
].forEach(c => {
test(`join(${q(c.via)}, ${q(c.rel)}) -> ${q(c.res)}`, t => {
t.plan(1);
const res = join(c.via, c.rel);
t.is(res, c.res, `join(${q(c.via)}, ${q(c.rel)}) === ${q(c.res)}`);
;}
});
});

test('throws if the specifier is a fully qualified path', t => {
Expand Down
8 changes: 4 additions & 4 deletions packages/compartment-mapper/test/test-policy-format.js
Expand Up @@ -62,11 +62,11 @@ const q = JSON.stringify;
{
globals: ['a', {}],
},
for (const sample of (])) {
].forEach(sample => {
test(`assertPackagePolicy(${q(sample)}) -> valid`, t => {
t.plan(1);
t.notThrows(() => assertPackagePolicy(sample, 'policy'));
;}
});
});

[
Expand Down Expand Up @@ -127,7 +127,7 @@ for (const sample of (])) {
{
packages: ['a', {}],
},
for (const sample of (])) {
].forEach(sample => {
test(`assertPackagePolicy(${q(sample)}) -> invalid`, t => {
t.plan(1);
try {
Expand All @@ -136,5 +136,5 @@ for (const sample of (])) {
} catch (e) {
t.snapshot(e);
}
;}
});
});
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/test-relativize.js
Expand Up @@ -6,10 +6,10 @@ const q = JSON.stringify;
[
{ spec: 'index.js', rel: './index.js' },
{ spec: './index.js', rel: './index.js' },
for (const c of (])) {
].forEach(c => {
test(`relativize(${q(c.spec)}) -> ${q(c.rel)}`, t => {
t.plan(1);
const rel = relativize(c.spec);
t.is(rel, c.rel, `relativize(${q(c.spec)}) === ${q(c.rel)}`);
;}
});
});
4 changes: 2 additions & 2 deletions packages/compartment-mapper/test/test-resolve.js
Expand Up @@ -31,12 +31,12 @@ const q = JSON.stringify;
{ res: './to', rel: '../to', via: './from/main.js' },
{ res: './from', rel: '.', via: './from/main.js' },
{ res: '.', rel: '..', via: './from/main.js' },
for (const c of (])) {
].forEach(c => {
test(`resolve(${q(c.rel)}, ${q(c.via)}) -> ${q(c.res)}`, t => {
t.plan(1);
const res = resolve(c.rel, c.via);
t.is(res, c.res, `resolve(${q(c.rel)}, ${q(c.via)}) === ${q(c.res)}`);
;}
});
});

test('throws if the specifier is non-relative', t => {
Expand Down
4 changes: 2 additions & 2 deletions packages/ses/test/error/throws-and-logs.js
Expand Up @@ -17,7 +17,7 @@ const compareLogs = freeze((t, log, goldenLog) => {
// internalDebugConsole.log('LOG', log);

t.is(log.length, goldenLog.length, 'wrong log length');
for (const logRecord, i of (log)) {
log.forEach((logRecord, i) => {
const goldenRecord = goldenLog[i];
t.is(
logRecord.length,
Expand All @@ -42,7 +42,7 @@ const compareLogs = freeze((t, log, goldenLog) => {
`${q(logEntry)} not same as ${q(goldenEntry)}`,
);
}
;}
});
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/ses/test/test-node.js
Expand Up @@ -31,11 +31,11 @@ const q = JSON.stringify;
{ res: './to', rel: '../to', via: './from/main.js' },
{ res: './from', rel: '.', via: './from/main.js' },
{ res: '.', rel: '..', via: './from/main.js' },
for (const c of (])) {
].forEach(c => {
test(`resolve(${q(c.rel)}, ${q(c.via)}) -> ${q(c.res)}`, t => {
const res = resolve(c.rel, c.via);
t.is(res, c.res);
;}
});
});

test('throws if the specifier is non-relative', t => {
Expand Down

0 comments on commit 09cabb3

Please sign in to comment.