1
1
'use strict' ;
2
2
3
3
const fs = require ( 'fs-extra' ) ;
4
+ const path = require ( 'path' ) ;
4
5
const index = require ( '../lib/index' ) ;
5
6
const utils = require ( '../lib/utils' ) ;
6
7
const sinon = require ( 'sinon' ) ;
@@ -25,7 +26,9 @@ const pages = [
25
26
'/pages/sunos/dd.md' ,
26
27
'/pages/sunos/du.md' ,
27
28
'/pages/sunos/svcs.md'
28
- ] ;
29
+ ] . map ( ( x ) => {
30
+ return path . join ( x ) ;
31
+ } ) ;
29
32
30
33
describe ( 'Index building' , ( ) => {
31
34
beforeEach ( ( ) => {
@@ -81,77 +84,77 @@ describe('Index', () => {
81
84
it ( 'should find Linux platform for apk command for Chinese' , ( ) => {
82
85
return index . findPage ( 'apk' , 'linux' , 'zh' )
83
86
. then ( ( folder ) => {
84
- return folder . should . equal ( 'pages.zh/ linux' ) ;
87
+ return folder . should . equal ( path . join ( 'pages.zh' , ' linux') ) ;
85
88
} ) ;
86
89
} ) ;
87
90
88
91
it ( 'should find Linux platform for apk command for Chinese given Windows' , ( ) => {
89
92
return index . findPage ( 'apk' , 'windows' , 'zh' )
90
93
. then ( ( folder ) => {
91
- return folder . should . equal ( 'pages.zh/ linux' ) ;
94
+ return folder . should . equal ( path . join ( 'pages.zh' , ' linux') ) ;
92
95
} ) ;
93
96
} ) ;
94
97
95
98
it ( 'should find Linux platform for dd command' , ( ) => {
96
99
return index . findPage ( 'dd' , 'linux' , 'en' )
97
100
. then ( ( folder ) => {
98
- return folder . should . equal ( 'pages/ linux' ) ;
101
+ return folder . should . equal ( path . join ( 'pages' , ' linux') ) ;
99
102
} ) ;
100
103
} ) ;
101
104
102
105
it ( 'should find platform common for cp command for English' , ( ) => {
103
106
return index . findPage ( 'cp' , 'linux' , 'en' )
104
107
. then ( ( folder ) => {
105
- return folder . should . equal ( 'pages/ common' ) ;
108
+ return folder . should . equal ( path . join ( 'pages' , ' common') ) ;
106
109
} ) ;
107
110
} ) ;
108
111
109
112
it ( 'should find platform common for cp command for Tamil' , ( ) => {
110
113
return index . findPage ( 'cp' , 'linux' , 'ta' )
111
114
. then ( ( folder ) => {
112
- return folder . should . equal ( 'pages.ta/ common' ) ;
115
+ return folder . should . equal ( path . join ( 'pages.ta' , ' common') ) ;
113
116
} ) ;
114
117
} ) ;
115
118
116
119
it ( 'should find platform common for cp command for Italian' , ( ) => {
117
120
return index . findPage ( 'cp' , 'linux' , 'it' )
118
121
. then ( ( folder ) => {
119
- return folder . should . equal ( 'pages.it/ common' ) ;
122
+ return folder . should . equal ( path . join ( 'pages.it' , ' common') ) ;
120
123
} ) ;
121
124
} ) ;
122
125
123
126
it ( 'should find platform common for cp command for Italian given Windows' , ( ) => {
124
127
return index . findPage ( 'cp' , 'windows' , 'it' )
125
128
. then ( ( folder ) => {
126
- return folder . should . equal ( 'pages.it/ common' ) ;
129
+ return folder . should . equal ( path . join ( 'pages.it' , ' common') ) ;
127
130
} ) ;
128
131
} ) ;
129
132
130
133
it ( 'should find platform common for ls command for Italian' , ( ) => {
131
134
return index . findPage ( 'ls' , 'linux' , 'it' )
132
135
. then ( ( folder ) => {
133
- return folder . should . equal ( 'pages/ common' ) ;
136
+ return folder . should . equal ( path . join ( 'pages' , ' common') ) ;
134
137
} ) ;
135
138
} ) ;
136
139
137
140
it ( 'should find platform common for cp command for Italian given common platform' , ( ) => {
138
141
return index . findPage ( 'cp' , 'common' , 'it' )
139
142
. then ( ( folder ) => {
140
- return folder . should . equal ( 'pages.it/ common' ) ;
143
+ return folder . should . equal ( path . join ( 'pages.it' , ' common') ) ;
141
144
} ) ;
142
145
} ) ;
143
146
144
147
it ( 'should find platform common for cp command for English given a bad language' , ( ) => {
145
148
return index . findPage ( 'cp' , 'linux' , 'notexist' )
146
149
. then ( ( folder ) => {
147
- return folder . should . equal ( 'pages/ common' ) ;
150
+ return folder . should . equal ( path . join ( 'pages' , ' common') ) ;
148
151
} ) ;
149
152
} ) ;
150
153
151
154
it ( 'should find platform for svcs command on Linux' , ( ) => {
152
155
return index . findPage ( 'svcs' , 'linux' , 'en' )
153
156
. then ( ( folder ) => {
154
- return folder . should . equal ( 'pages/ sunos' ) ;
157
+ return folder . should . equal ( path . join ( 'pages' , ' sunos') ) ;
155
158
} ) ;
156
159
} ) ;
157
160
0 commit comments