11import test from 'ava' ;
2- import isPromise from 'is-promise' ;
32import cfgResolve from '../lib/cfg-resolve' ;
43
54test ( 'should return function' , t => {
65 t . true ( typeof cfgResolve === 'function' ) ;
76} ) ;
87
9- test ( 'should return promise' , t => {
10- t . true ( isPromise ( cfgResolve ( ) ) ) ;
11- } ) ;
12-
138test ( 'should return config with one use key without property' , async t => {
149 const flags = {
1510 use : 'posthtml-bem'
1611 } ;
17- const config = await cfgResolve ( flags ) ;
18- const expected = { plugins : { 'posthtml-bem' : { } } } ;
12+ const config = await cfgResolve ( { flags} ) ;
13+ const expected = { 'posthtml-bem' : { } } ;
1914
20- t . deepEqual ( config , expected ) ;
15+ t . deepEqual ( config . plugins , expected ) ;
2116} ) ;
2217
2318test ( 'should return config with one use key with one property' , async t => {
@@ -27,30 +22,30 @@ test('should return config with one use key with one property', async t => {
2722 prefix : '__'
2823 }
2924 } ;
30- const config = await cfgResolve ( flags ) ;
31- const expected = { plugins : { 'posthtml-bem' : { prefix : '__' } } } ;
25+ const config = await cfgResolve ( { flags} ) ;
26+ const expected = { 'posthtml-bem' : { prefix : '__' } } ;
3227
33- t . deepEqual ( config , expected ) ;
28+ t . deepEqual ( config . plugins , expected ) ;
3429} ) ;
3530
3631test ( 'should return config with key config' , async t => {
3732 const flags = {
3833 config : 'test/config/.config'
3934 } ;
40- const config = await cfgResolve ( flags ) ;
41- const expected = { plugins : { 'posthtml-bem' : { } } } ;
35+ const config = await cfgResolve ( { flags} ) ;
36+ const expected = { 'posthtml-bem' : { } } ;
4237
43- t . deepEqual ( config , expected ) ;
38+ t . deepEqual ( config . plugins , expected ) ;
4439} ) ;
4540
4641test ( 'should return config with key config and use key' , async t => {
4742 const flags = {
4843 use : 'posthtml-assets' ,
4944 config : 'test/config/.config'
5045 } ;
51- const config = await cfgResolve ( flags ) ;
52- const expected = { plugins : { 'posthtml-bem' : { } , 'posthtml-assets' : { } } } ;
46+ const config = await cfgResolve ( { flags} ) ;
47+ const expected = { 'posthtml-bem' : { } , 'posthtml-assets' : { } } ;
5348
54- t . deepEqual ( config , expected ) ;
49+ t . deepEqual ( config . plugins , expected ) ;
5550} ) ;
5651
0 commit comments