-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathserve.test.ts
More file actions
25 lines (20 loc) · 1.06 KB
/
serve.test.ts
File metadata and controls
25 lines (20 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import test from 'ava';
import { pathExists } from 'path-exists';
import { temporaryDirectoryTask } from 'tempy';
import { newMemDBPlugin } from '../memdb/memdb.js';
import { createServeCommand } from './serve.js';
const serve = createServeCommand(newMemDBPlugin()).exitProcess(false);
test('should return error without command', (t) => {
t.throws(() => serve.parse([]), { message: 'Specify a command to run' });
});
test('should build memdb docker plugin', async (t) => {
delete process.env.CQ_TELEMETRY_LEVEL;
await temporaryDirectoryTask(async (outputDirectory) => {
await serve.parse(['package', '-m', 'test', 'v1.0.0', '.', '--dist-dir', outputDirectory, '--log-level', 'debug']);
t.true(await pathExists(`${outputDirectory}/tables.json`));
t.true(await pathExists(`${outputDirectory}/package.json`));
t.true(await pathExists(`${outputDirectory}/plugin-memdb-v1.0.0-linux-amd64.tar`));
t.true(await pathExists(`${outputDirectory}/plugin-memdb-v1.0.0-linux-arm64.tar`));
t.true(await pathExists(`${outputDirectory}/docs/overview.md`));
});
});