@@ -7,36 +7,41 @@ const testCases = {
7
7
title : '' ,
8
8
_draft : false ,
9
9
_partial : false ,
10
- _path : '/'
10
+ _path : '/' ,
11
+ _dir : ''
11
12
} ,
12
13
'content:3.index.draft.md' : {
13
14
__description : 'Index file with position [Draft]' ,
14
15
title : '' ,
15
16
_draft : true ,
16
17
_partial : false ,
17
- _path : '/'
18
+ _path : '/' ,
19
+ _dir : ''
18
20
} ,
19
21
'content:1.blog:3.index.draft.md' : {
20
22
__description : 'Blog Index file with position [Draft]' ,
21
23
title : '' ,
22
24
_draft : true ,
23
25
_partial : false ,
24
- _path : '/blog'
26
+ _path : '/blog' ,
27
+ _dir : ''
25
28
} ,
26
29
'content:1.blog:_4.the-post.md' : {
27
30
__description : 'Blog post file with position [Partial]' ,
28
31
title : '4The Post' ,
29
32
_draft : false ,
30
33
_partial : true ,
31
- _path : '/blog/_4.the-post'
34
+ _path : '/blog/_4.the-post' ,
35
+ _dir : 'blog'
32
36
} ,
33
37
...[ '1.0.0' , '1.1' , '1' , '1.x' , '1.0.x' , '1.0.0.x' ] . reduce ( ( map , semver ) => {
34
38
map [ `content:${ semver } :doc.md` ] = {
35
39
title : 'Doc' ,
36
40
_draft : false ,
37
41
_partial : false ,
38
42
_path : `/${ semver } /doc` ,
39
- _source : 'content'
43
+ _source : 'content' ,
44
+ _dir : semver
40
45
}
41
46
return map
42
47
} , { } ) ,
@@ -45,28 +50,32 @@ const testCases = {
45
50
title : 'Doc' ,
46
51
_draft : false ,
47
52
_partial : false ,
48
- _path : '/one/two/three/four/five/doc'
53
+ _path : '/one/two/three/four/five/doc' ,
54
+ _dir : 'five'
49
55
} ,
50
56
'content:1.one:file?param=value#hash.md' : {
51
57
__description : 'Handle special chars in file name' ,
52
58
title : 'File?param=value#hash' ,
53
59
_draft : false ,
54
60
_partial : false ,
55
- _path : '/one/fileparamvaluehash'
61
+ _path : '/one/fileparamvaluehash' ,
62
+ _dir : 'one'
56
63
} ,
57
64
'content:indexer.md' : {
58
65
__description : 'non-index file with index substring' ,
59
66
title : 'Indexer' ,
60
67
_draft : false ,
61
68
_partial : false ,
62
- _path : '/indexer'
69
+ _path : '/indexer' ,
70
+ _dir : ''
63
71
} ,
64
72
'content:indexer.draft.md' : {
65
73
__description : 'non-index file with index substring' ,
66
74
title : 'Indexer' ,
67
75
_draft : true ,
68
76
_partial : false ,
69
- _path : '/indexer'
77
+ _path : '/indexer' ,
78
+ _dir : ''
70
79
}
71
80
}
72
81
@@ -110,6 +119,12 @@ export const testPathMetaTransformer = () => {
110
119
`source is not equal, recieved: ${ transformed . _source } `
111
120
)
112
121
122
+ expect ( transformed ) . toHaveProperty ( '_dir' )
123
+ assert (
124
+ transformed . _dir === expected . _dir ,
125
+ `directory is not equal, recieved: ${ transformed . _dir } `
126
+ )
127
+
113
128
expect ( transformed ) . toHaveProperty ( '_path' )
114
129
assert (
115
130
fullPath . startsWith ( `${ transformed . _source } /${ transformed . _file } ` ) ,
0 commit comments