-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin.test.ts
More file actions
41 lines (37 loc) · 1.19 KB
/
plugin.test.ts
File metadata and controls
41 lines (37 loc) · 1.19 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { createServeCommand } from "@cloudquery/plugin-sdk-javascript/plugin/serve";
import test from "ava";
import { pathExists } from "path-exists";
import { temporaryDirectoryTask } from "tempy";
import { newSamplePlugin } from "./plugin.js";
const serve = createServeCommand(newSamplePlugin()).exitProcess(false);
test("should return error without command", (t) => {
t.throws(() => serve.parse([]), { message: "Specify a command to run" });
});
test("should build sample docker plugin", async (t) => {
await temporaryDirectoryTask(async (outputDirectory: string) => {
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-cq-js-sample-v1.0.0-linux-amd64.tar`,
),
);
t.true(
await pathExists(
`${outputDirectory}/plugin-cq-js-sample-v1.0.0-linux-arm64.tar`,
),
);
t.true(await pathExists(`${outputDirectory}/docs/overview.md`));
});
});