Skip to content

Commit

Permalink
Merge pull request #1254 from Agoric/remove-trivial-test-junk
Browse files Browse the repository at this point in the history
Remove trivial test functions
  • Loading branch information
FUDCo authored Jul 4, 2020
2 parents ada087e + 88bb936 commit b2bb165
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 135 deletions.
12 changes: 2 additions & 10 deletions packages/SwingSet/test/test-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test('reject module-like sourceIndex', async t => {
t.end();
});

async function bootstrap(t) {
test('bootstrap', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-controller-2'),
);
Expand All @@ -103,13 +103,9 @@ async function bootstrap(t) {
const c = await buildVatController(config);
t.deepEqual(c.dump().log, ['bootstrap called']);
t.end();
}

test('bootstrap', async t => {
await bootstrap(t);
});

async function bootstrapExport(t) {
test('bootstrap export', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-controller-3'),
);
Expand Down Expand Up @@ -267,8 +263,4 @@ async function bootstrapExport(t) {
t.deepEqual(c.dump().runQueue, []);

t.end();
}

test('bootstrap export', async t => {
await bootstrapExport(t);
});
42 changes: 7 additions & 35 deletions packages/SwingSet/test/test-devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function capargs(args, slots = []) {
return capdata(JSON.stringify(args), slots);
}

async function test0(t) {
test('d0', async t => {
const config = {
vats: new Map(),
devices: [['d0', require.resolve('./files-devices/device-0'), {}]],
Expand All @@ -39,13 +39,9 @@ async function test0(t) {
]);
t.deepEqual(JSON.parse(c.dump().log[1]), ['o+0', 'o-50', 'd-70', 'd-71']);
t.end();
}

test('d0', async t => {
await test0(t);
});

async function test1(t) {
test('d1', async t => {
const sharedArray = [];
const config = {
vats: new Map(),
Expand All @@ -72,10 +68,6 @@ async function test1(t) {
]);
t.deepEqual(sharedArray, ['pushed']);
t.end();
}

test('d1', async t => {
await test1(t);
});

async function test2(t, mode) {
Expand Down Expand Up @@ -158,7 +150,7 @@ test('d2.5', async t => {
await test2(t, '5');
});

async function testState(t) {
test('device state', async t => {
const { storage } = initSwingStore();
const config = {
vats: new Map(),
Expand All @@ -178,13 +170,9 @@ async function testState(t) {
t.deepEqual(JSON.parse(s[`${d3}.o.nextID`]), 10);

t.end();
}

test('device state', async t => {
await testState(t);
});

async function testMailboxOutbound(t) {
test('mailbox outbound', async t => {
const s = buildMailboxStateMap();
const mb = buildMailbox(s);
const config = {
Expand Down Expand Up @@ -218,13 +206,9 @@ async function testMailboxOutbound(t) {
t.deepEqual(s.exportToData(), s2.exportToData());

t.end();
}

test('mailbox outbound', async t => {
await testMailboxOutbound(t);
});

async function testMailboxInbound(t) {
test('mailbox inbound', async t => {
const s = buildMailboxStateMap();
const mb = buildMailbox(s);
const config = {
Expand Down Expand Up @@ -335,13 +319,9 @@ async function testMailboxInbound(t) {
]);

t.end();
}

test('mailbox inbound', async t => {
await testMailboxInbound(t);
});

async function testCommandBroadcast(t) {
test('command broadcast', async t => {
const broadcasts = [];
const cm = buildCommand(body => broadcasts.push(body));
const config = {
Expand All @@ -355,13 +335,9 @@ async function testCommandBroadcast(t) {
t.deepEqual(broadcasts, [{ hello: 'everybody' }]);

t.end();
}

test('command broadcast', async t => {
await testCommandBroadcast(t);
});

async function testCommandDeliver(t) {
test('command deliver', async t => {
const cm = buildCommand(() => {});
const config = {
vats: new Map(),
Expand Down Expand Up @@ -390,8 +366,4 @@ async function testCommandDeliver(t) {
t.deepEqual(rejection, { response: 'body' });

t.end();
}

test('command deliver', async t => {
await testCommandDeliver(t);
});
54 changes: 9 additions & 45 deletions packages/SwingSet/test/test-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ import { buildVatController, loadBasedir } from '../src/index';

const RETIRE_KPIDS = true;

async function testFlush(t) {
test('flush', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['flush']);
// all promises should settle before c.step() fires
await c.step();
t.deepEqual(c.dump().log, ['bootstrap called', 'then1', 'then2']);
t.end();
}

test('flush', async t => {
await testFlush(t);
});

async function testEThen(t) {
test('E() resolve', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['e-then']);

Expand All @@ -31,13 +27,9 @@ async function testEThen(t) {
'left.then 4',
]);
t.end();
}

test('E() resolve', async t => {
await testEThen(t);
});

async function testChain1(t) {
test('E(E(x).foo()).bar()', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['chain1']);

Expand All @@ -59,13 +51,9 @@ async function testChain1(t) {
'b.resolved 3',
]);
t.end();
}

test('E(E(x).foo()).bar()', async t => {
await testChain1(t);
});

async function testChain2(t) {
test('E(Promise.resolve(presence)).foo()', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['chain2']);

Expand All @@ -78,13 +66,9 @@ async function testChain2(t) {
'b.resolved 3',
]);
t.end();
}

test('E(Promise.resolve(presence)).foo()', async t => {
await testChain2(t);
});

async function testLocal1(t) {
test('E(local).foo()', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['local1']);

Expand All @@ -96,13 +80,9 @@ async function testLocal1(t) {
'b.resolved 2',
]);
t.end();
}

test('E(local).foo()', async t => {
await testLocal1(t);
});

async function testLocal2(t) {
test('resolve-to-local', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['local2']);

Expand All @@ -115,13 +95,9 @@ async function testLocal2(t) {
'b.resolved 3',
]);
t.end();
}

test('resolve-to-local', async t => {
await testLocal2(t);
});

async function testSendPromise1(t) {
test('send-promise-resolve-to-local', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-promises'));
const c = await buildVatController(config, ['send-promise1']);

Expand All @@ -135,13 +111,9 @@ async function testSendPromise1(t) {
'b.resolved 4',
]);
t.end();
}

test('send-promise-resolve-to-local', async t => {
await testSendPromise1(t);
});

async function testHardenPromise1(t) {
test('send-harden-promise-1', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-promises-2'),
);
Expand All @@ -162,13 +134,9 @@ async function testHardenPromise1(t) {
'b.harden-promise-1.finish',
]);
t.end();
}

test('send-harden-promise-1', async t => {
await testHardenPromise1(t);
});

async function testCircularPromiseData(t) {
test('circular promise resolution data', async t => {
const config = await loadBasedir(path.resolve(__dirname, 'basedir-circular'));
const c = await buildVatController(config);

Expand Down Expand Up @@ -206,8 +174,4 @@ async function testCircularPromiseData(t) {
}
t.deepEqual(c.dump().promises, expectedPromises);
t.end();
}

test('circular promise resolution data', async t => {
await testCircularPromiseData(t);
});
6 changes: 1 addition & 5 deletions packages/SwingSet/test/test-transcript-light.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@agoric/swing-store-simple';
import { buildVatController, loadBasedir } from '../src/index';

async function testLoadState(t) {
test('transcript-light load', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
Expand Down Expand Up @@ -100,8 +100,4 @@ async function testLoadState(t) {
t.deepEqual(state5, getAllState(storage2), `p14`);

t.end();
}

test('transcript-light load', async t => {
await testLoadState(t);
});
12 changes: 2 additions & 10 deletions packages/SwingSet/test/test-transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function buildTrace(c, storage) {
return states;
}

async function testSaveState(t) {
test('transcript-one save', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
Expand All @@ -42,13 +42,9 @@ async function testSaveState(t) {
t.deepEqual(s, states2[i]);
});
t.end();
}

test('transcript-one save', async t => {
await testSaveState(t);
});

async function testLoadState(t) {
test('transcript-one load', async t => {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
Expand Down Expand Up @@ -78,8 +74,4 @@ async function testLoadState(t) {
t.deepEqual(states.slice(i), newstates);
}
t.end();
}

test('transcript-one load', async t => {
await testLoadState(t);
});
12 changes: 2 additions & 10 deletions packages/SwingSet/test/test-vattp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test } from 'tape-promise/tape';
import { buildVatController, getVatTPSourcePath } from '../src/index';
import { buildMailboxStateMap, buildMailbox } from '../src/devices/mailbox';

async function testVatTP(t) {
test('vattp', async t => {
const s = buildMailboxStateMap();
const mb = buildMailbox(s);
const config = {
Expand Down Expand Up @@ -51,13 +51,9 @@ async function testVatTP(t) {
t.deepEqual(s.exportToData(), { remote1: { outbox: [], inboundAck: 2 } });

t.end();
}

test('vattp', async t => {
await testVatTP(t);
});

async function testVatTP2(t) {
test('vattp 2', async t => {
const s = buildMailboxStateMap();
const mb = buildMailbox(s);
const config = {
Expand Down Expand Up @@ -101,8 +97,4 @@ async function testVatTP2(t) {
t.deepEqual(s.exportToData(), { remote1: { outbox: [], inboundAck: 2 } });

t.end();
}

test('vattp 2', async t => {
await testVatTP2(t);
});
Loading

0 comments on commit b2bb165

Please sign in to comment.