-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinit.templates.test.ts
More file actions
66 lines (57 loc) · 1.91 KB
/
init.templates.test.ts
File metadata and controls
66 lines (57 loc) · 1.91 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
jest.setTimeout(30000);
import fs from 'fs';
import os from 'os';
import path from 'path';
import { scaffoldTemplate } from '@pgpmjs/core';
const TEMPLATE_REPO = 'https://github.com/constructive-io/pgpm-boilerplates.git';
describe('Template scaffolding', () => {
it('processes workspace template from default repo', async () => {
const outDir = fs.mkdtempSync(path.join(os.tmpdir(), 'launchql-workspace-'));
await scaffoldTemplate({
type: 'workspace',
outputDir: outDir,
templateRepo: TEMPLATE_REPO,
branch: 'restructuring', // TODO: remove after merging restructuring to main
templatePath: 'default/workspace',
answers: {
name: 'demo-workspace',
fullName: 'Tester',
email: 'tester@example.com',
moduleName: 'demo-module',
username: 'tester',
repoName: 'demo-module',
license: 'MIT'
},
noTty: true
});
expect(fs.existsSync(outDir)).toBe(true);
fs.rmSync(outDir, { recursive: true, force: true });
});
it('processes module template from default repo', async () => {
const outDir = fs.mkdtempSync(path.join(os.tmpdir(), 'launchql-module-'));
await scaffoldTemplate({
type: 'module',
outputDir: outDir,
templateRepo: TEMPLATE_REPO,
branch: 'restructuring', // TODO: remove after merging restructuring to main
templatePath: 'default/module',
answers: {
name: 'demo-module',
description: 'demo module',
author: 'tester',
fullName: 'Tester',
email: 'tester@example.com',
moduleDesc: 'demo module',
moduleName: 'demo-module',
repoName: 'demo-module',
access: 'public',
license: 'MIT',
username: 'tester',
packageIdentifier: 'demo-module'
},
noTty: true
});
expect(fs.existsSync(outDir)).toBe(true);
fs.rmSync(outDir, { recursive: true, force: true });
});
});