forked from cloudflare/workers-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelpers.ts
35 lines (32 loc) · 784 Bytes
/
helpers.ts
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
import { C3_DEFAULTS } from "helpers/cli";
import type { TemplateConfig } from "../templates";
import type { C3Args, C3Context } from "types";
export const createTestArgs = (args?: Partial<C3Args>) => {
return {
...C3_DEFAULTS,
...args,
};
};
export const createTestContext = (name = "test", args?: C3Args): C3Context => {
const path = `./${name}`;
return {
project: { name, path },
args: args ?? createTestArgs(),
originalCWD: path,
gitRepoAlreadyExisted: false,
template: createTestTemplate(),
deployment: {},
};
};
export const createTestTemplate = (
config?: Partial<TemplateConfig>,
): TemplateConfig => {
return {
...config,
id: "test",
platform: "workers",
displayName: "Test Template",
configVersion: 1,
generate: Promise.resolve,
};
};