@@ -257,6 +257,52 @@ describe('Utils → Pattern', () => {
257
257
} ) ;
258
258
} ) ;
259
259
260
+ describe ( '.getPatternsInsideCurrentDirectory' , ( ) => {
261
+ it ( 'should return patterns' , ( ) => {
262
+ const expected : Pattern [ ] = [ '.' , './*' , '*' , 'a/*' ] ;
263
+
264
+ const actual = util . getPatternsInsideCurrentDirectory ( [ '.' , './*' , '*' , 'a/*' , '..' , '../*' , './..' , './../*' ] ) ;
265
+
266
+ assert . deepStrictEqual ( actual , expected ) ;
267
+ } ) ;
268
+ } ) ;
269
+
270
+ describe ( '.getPatternsOutsideCurrentDirectory' , ( ) => {
271
+ it ( 'should return patterns' , ( ) => {
272
+ const expected : Pattern [ ] = [ '..' , '../*' , './..' , './../*' ] ;
273
+
274
+ const actual = util . getPatternsOutsideCurrentDirectory ( [ '.' , './*' , '*' , 'a/*' , '..' , '../*' , './..' , './../*' ] ) ;
275
+
276
+ assert . deepStrictEqual ( actual , expected ) ;
277
+ } ) ;
278
+ } ) ;
279
+
280
+ describe ( '.isPatternRelatedToParentDirectory' , ( ) => {
281
+ it ( 'should be `false` when the pattern refers to the current directory' , ( ) => {
282
+ const actual = util . isPatternRelatedToParentDirectory ( '.' ) ;
283
+
284
+ assert . ok ( ! actual ) ;
285
+ } ) ;
286
+
287
+ it ( 'should be `true` when the pattern equals to `..`' , ( ) => {
288
+ const actual = util . isPatternRelatedToParentDirectory ( '..' ) ;
289
+
290
+ assert . ok ( actual ) ;
291
+ } ) ;
292
+
293
+ it ( 'should be `true` when the pattern starts with `..` segment' , ( ) => {
294
+ const actual = util . isPatternRelatedToParentDirectory ( '../*' ) ;
295
+
296
+ assert . ok ( actual ) ;
297
+ } ) ;
298
+
299
+ it ( 'should be `true` when the pattern starts with `./..` segment' , ( ) => {
300
+ const actual = util . isPatternRelatedToParentDirectory ( './../*' ) ;
301
+
302
+ assert . ok ( actual ) ;
303
+ } ) ;
304
+ } ) ;
305
+
260
306
describe ( '.getBaseDirectory' , ( ) => {
261
307
it ( 'should returns base directory' , ( ) => {
262
308
const expected = 'root' ;
0 commit comments