This repository was archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcli-init.test.js
More file actions
38 lines (34 loc) · 2.29 KB
/
cli-init.test.js
File metadata and controls
38 lines (34 loc) · 2.29 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
const exists = require('path-exists');
const getUniqueProjectPath = require('./utils/getUniqueProjectPath');
const path = require('path');
const spawnCmd = require('./utils/spawnCmd');
const tap = require('tap');
const wrapAsync = require('../bin/utils').wrapAsync;
const projectRoot = getUniqueProjectPath();
tap.test('Init ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-mustache-base']);
t.ok(exists.sync(path.resolve(projectRoot)), 'should initialize a PatternLab project');
t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir');
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir');
t.ok(exists.sync(path.resolve(projectRoot, 'pattern_exports')), 'with a pattern_exports dir');
t.ok(exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), 'with a patternlab-config file');
t.end();
}));
tap.test('Init starterkit-twig-base ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-twig-base']);
t.ok(exists.sync(path.resolve(projectRoot)), 'should initialize a PatternLab project');
t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir');
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir');
t.ok(exists.sync(path.resolve(projectRoot, 'pattern_exports')), 'with a pattern_exports dir');
t.ok(exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), 'with a patternlab-config file');
t.end();
}));
tap.test('Init starterkit-twig-demo ->', t => wrapAsync(function*() {
yield spawnCmd(['init', '--verbose', '--project-dir', projectRoot, '--edition', 'edition-node', '--starterkit', '@pattern-lab/starterkit-twig-demo']);
t.ok(exists.sync(path.resolve(projectRoot)), 'should initialize a PatternLab project');
t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir');
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir');
t.ok(exists.sync(path.resolve(projectRoot, 'pattern_exports')), 'with a pattern_exports dir');
t.ok(exists.sync(path.resolve(projectRoot, 'patternlab-config.json')), 'with a patternlab-config file');
t.end();
}));