Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit ab23893

Browse files
committed
Adding scaffold test
1 parent 31d3264 commit ab23893

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

test/replace_config_paths.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ const config = require('./fixtures/patternlab-config.json');
44

55
tap.test('replaceConfigPaths ->', t => {
66
const newConfig = replaceConfigPaths(config, 'projectDir', 'sourceDir', 'publicDir', 'exportDir');
7+
console.log(newConfig.patternExportDirectory);
8+
79
for (const k of Object.keys(newConfig.paths.source)) {
810
t.ok(/^projectDir\/sourceDir\/|^node_modules/.test(newConfig.paths.source[k]), `should be ok for newConfig.paths.source.${k}`);
911
}
1012
for (const k of Object.keys(newConfig.paths.public)) {
1113
t.ok(/^projectDir\/publicDir\//.test(newConfig.paths.public[k]), `should be ok for newConfig.paths.public.${k}`);
1214
}
13-
t.ok(/^projectDir\/exportDir\//.test(newConfig.paths.patternExportDirectory), `should be ok for newConfig.paths.patternExportDirectory`);
15+
t.ok(/^projectDir\/exportDir/.test(newConfig.patternExportDirectory), `should be ok for newConfig.patternExportDirectory`);
1416
t.end();
1517
});

test/scaffold.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const tap = require('tap');
2+
const path = require('path');
3+
const exists = require('path-exists');
4+
const scaffold = require('../bin/generator').scaffold;
5+
const wrapAsync = require('../bin/utils').wrapAsync;
6+
7+
const projectDir = './test/tmp';
8+
const sourceDir = 'source';
9+
const publicDir = 'public';
10+
const exportDir = 'patterns_export';
11+
12+
tap.test('Scaffold ->', t => wrapAsync(function*() {
13+
yield scaffold(projectDir, sourceDir, publicDir, exportDir);
14+
t.ok(exists.sync(path.resolve(projectDir)), 'should create project dir');
15+
t.ok(exists.sync(path.resolve(projectDir, sourceDir)), 'should create source dir');
16+
t.ok(exists.sync(path.resolve(projectDir, publicDir)), 'should create public dir');
17+
t.ok(exists.sync(path.resolve(projectDir, exportDir)), 'should create export dir');
18+
t.end();
19+
}));

0 commit comments

Comments
 (0)