forked from pattern-lab/patternlab-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexportData_tests.js
More file actions
68 lines (54 loc) · 1.86 KB
/
exportData_tests.js
File metadata and controls
68 lines (54 loc) · 1.86 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
67
68
'use strict';
const path = require('path');
const tap = require('tap');
const rewire = require('rewire');
const exportData = rewire('../src/lib/exportData');
const util = require('./util/test_utils.js');
const testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
const fsMock = {
outputFileSync: function(path, content) {
/* INTENTIONAL NOOP */
},
};
//set our mocks in place of usual require()
exportData.__set__({
fs: fsMock,
});
const patternlab = util.fakePatternLab(testPatternsPath);
const result = exportData(patternlab);
tap.test('exportData exports config', function(test) {
test.equals(result.indexOf('config') > -1, true);
test.equals(result.indexOf('paths') > -1, true);
test.equals(result.indexOf('theme') > -1, true);
test.end();
});
tap.test('exportData exports ishControls', function(test) {
test.equals(result.indexOf('ishControlsHide') > -1, true);
test.end();
});
tap.test('exportData exports navItems', function(test) {
test.equals(result.indexOf('patternTypes') > -1, true);
test.end();
});
tap.test('exportData exports patternPaths', function(test) {
test.equals(result.indexOf('patternPaths') > -1, true);
test.end();
});
tap.test('exportData exports viewAllPaths', function(test) {
test.equals(result.indexOf('viewAllPaths') > -1, true);
test.end();
});
tap.test('exportData exports plugins', function(test) {
test.equals(result.indexOf('plugins') > -1, true);
test.end();
});
tap.test('exportData exports defaultShowPatternInfo', function(test) {
test.equals(result.indexOf('defaultShowPatternInfo') > -1, true);
test.equals(result.indexOf('"defaultShowPatternInfo":false') > -1, true);
test.end();
});
tap.test('exportData exports defaultPattern', function(test) {
test.equals(result.indexOf('defaultPattern') > -1, true);
test.equals(result.indexOf('"defaultPattern":"all"') > -1, true);
test.end();
});