Skip to content

Commit 0bb76e4

Browse files
committed
test: for config io, #280, #256
1 parent e3222b8 commit 0bb76e4

File tree

12 files changed

+171
-24
lines changed

12 files changed

+171
-24
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>input-1</title>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>

test/test-cfg-resolve.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import test from 'ava';
2-
import isPromise from 'is-promise';
32
import cfgResolve from '../lib/cfg-resolve';
43

54
test('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-
138
test('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

2318
test('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

3631
test('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

4641
test('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

Comments
 (0)