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

Commit e1e4d59

Browse files
committed
Added resolveConfig test. Small fix in test/replace_config_paths.test.js
1 parent ab23893 commit e1e4d59

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

test/replace_config_paths.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ 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);
87

98
for (const k of Object.keys(newConfig.paths.source)) {
109
t.ok(/^projectDir\/sourceDir\/|^node_modules/.test(newConfig.paths.source[k]), `should be ok for newConfig.paths.source.${k}`);

test/resolve_config.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const tap = require('tap');
2+
const wrapAsync = require('../bin/utils').wrapAsync;
3+
const resolveConfig = require('../bin/resolve_config');
4+
5+
tap.test('resolveConfig ->', t => wrapAsync(function*() {
6+
const config = yield resolveConfig('./test/fixtures/patternlab-config.json');
7+
const badConfig = yield resolveConfig(123);
8+
const configNotFound = yield resolveConfig('./test/fixtures/some-config');
9+
10+
t.type(config, 'object', 'should return a config of type object');
11+
t.ok(config.paths, 'config should have a paths property');
12+
t.notOk(badConfig, 'returns false when configPath is not of type string');
13+
t.notOk(configNotFound, 'returns false when configPath is not found');
14+
t.end();
15+
}));

0 commit comments

Comments
 (0)