Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | import chai from 'chai'; |
||
10 | describe(`[module] configure`, function() { |
||
11 | describe(`[method] load`, function() { |
||
12 | let defaultconfpath = `.codingamerc`; |
||
13 | let defaultconf = { |
||
14 | "username": `me`, |
||
15 | "password": `somepass`, |
||
16 | "exercise": `5711567e959cf54dd2dd79c1b4c259560d6ba46`, |
||
17 | "tests": [1, 2], |
||
18 | "language": `Python`, |
||
19 | "bundle": `bundle.py` |
||
20 | }; |
||
21 | before(function () { |
||
22 | mockfs({ |
||
23 | [defaultconfpath]: JSON.stringify(defaultconf) |
||
24 | }); |
||
25 | }); |
||
26 | after(function () { |
||
27 | mockfs.restore(); |
||
28 | }); |
||
29 | |||
30 | it(`should return the content of file parsed as JSON`, function() { |
||
31 | let conf = configure.load(defaultconfpath); |
||
32 | return expect(conf).to.eventually.be.deep.equal(defaultconf); |
||
33 | }); |
||
34 | |||
35 | it(`should return options if path is incorrect and options is defined`, function() { |
||
36 | let conf = configure.load(undefined, defaultconf); |
||
37 | return expect(conf).to.eventually.be.deep.equal(defaultconf); |
||
38 | }); |
||
39 | }); |
||
40 | }); |
||
41 |