@@ -6,15 +6,13 @@ var util = require('util');
6
6
var expect = require ( 'expect' ) ;
7
7
var miss = require ( 'mississippi' ) ;
8
8
var cloneable = require ( 'cloneable-readable' ) ;
9
- var saferBuffer = require ( 'safer-buffer' ) ;
10
9
11
10
var File = require ( '../' ) ;
12
11
13
12
var pipe = miss . pipe ;
14
13
var from = miss . from ;
15
14
var concat = miss . concat ;
16
15
var isCloneable = cloneable . isCloneable ;
17
- var Buffer = saferBuffer . Buffer ;
18
16
19
17
var isWin = ( process . platform === 'win32' ) ;
20
18
@@ -98,7 +96,7 @@ describe('File', function() {
98
96
99
97
it ( 'defaults path to null' , function ( done ) {
100
98
var file = new File ( ) ;
101
- expect ( file . path ) . toNotExist ( ) ;
99
+ expect ( file . path ) . toBeFalsy ( ) ;
102
100
expect ( file . path ) . toEqual ( null ) ;
103
101
done ( ) ;
104
102
} ) ;
@@ -111,14 +109,14 @@ describe('File', function() {
111
109
112
110
it ( 'defaults stat to null' , function ( done ) {
113
111
var file = new File ( ) ;
114
- expect ( file . stat ) . toNotExist ( ) ;
112
+ expect ( file . stat ) . toBeFalsy ( ) ;
115
113
expect ( file . stat ) . toEqual ( null ) ;
116
114
done ( ) ;
117
115
} ) ;
118
116
119
117
it ( 'defaults contents to null' , function ( done ) {
120
118
var file = new File ( ) ;
121
- expect ( file . contents ) . toNotExist ( ) ;
119
+ expect ( file . contents ) . toBeFalsy ( ) ;
122
120
expect ( file . contents ) . toEqual ( null ) ;
123
121
done ( ) ;
124
122
} ) ;
@@ -435,11 +433,11 @@ describe('File', function() {
435
433
var file = new File ( options ) ;
436
434
var file2 = file . clone ( ) ;
437
435
438
- expect ( file2 ) . toNotBe ( file ) ;
436
+ expect ( file2 ) . not . toBe ( file ) ;
439
437
expect ( file2 . cwd ) . toEqual ( file . cwd ) ;
440
438
expect ( file2 . base ) . toEqual ( file . base ) ;
441
439
expect ( file2 . path ) . toEqual ( file . path ) ;
442
- expect ( file2 . contents ) . toNotBe ( file . contents ) ;
440
+ expect ( file2 . contents ) . not . toBe ( file . contents ) ;
443
441
expect ( file2 . contents . toString ( 'utf8' ) ) . toEqual ( file . contents . toString ( 'utf8' ) ) ;
444
442
done ( ) ;
445
443
} ) ;
@@ -457,10 +455,10 @@ describe('File', function() {
457
455
expect ( copy1 . contents ) . toBe ( file . contents ) ;
458
456
459
457
var copy2 = file . clone ( ) ;
460
- expect ( copy2 . contents ) . toNotBe ( file . contents ) ;
458
+ expect ( copy2 . contents ) . not . toBe ( file . contents ) ;
461
459
462
460
var copy3 = file . clone ( { contents : 'invalid' } ) ;
463
- expect ( copy3 . contents ) . toNotBe ( file . contents ) ;
461
+ expect ( copy3 . contents ) . not . toBe ( file . contents ) ;
464
462
done ( ) ;
465
463
} ) ;
466
464
@@ -474,11 +472,11 @@ describe('File', function() {
474
472
var file = new File ( options ) ;
475
473
var file2 = file . clone ( ) ;
476
474
477
- expect ( file2 ) . toNotBe ( file ) ;
475
+ expect ( file2 ) . not . toBe ( file ) ;
478
476
expect ( file2 . cwd ) . toEqual ( file . cwd ) ;
479
477
expect ( file2 . base ) . toEqual ( file . base ) ;
480
478
expect ( file2 . path ) . toEqual ( file . path ) ;
481
- expect ( file2 . contents ) . toNotBe ( file . contents ) ;
479
+ expect ( file2 . contents ) . not . toBe ( file . contents ) ;
482
480
483
481
var ends = 2 ;
484
482
var data = null ;
@@ -491,7 +489,7 @@ describe('File', function() {
491
489
}
492
490
493
491
if ( -- ends === 0 ) {
494
- expect ( data ) . toNotBe ( data2 ) ;
492
+ expect ( data ) . not . toBe ( data2 ) ;
495
493
expect ( data . toString ( 'utf8' ) ) . toEqual ( data2 . toString ( 'utf8' ) ) ;
496
494
done ( ) ;
497
495
}
@@ -596,7 +594,7 @@ describe('File', function() {
596
594
var file = new File ( options ) ;
597
595
var file2 = file . clone ( ) ;
598
596
599
- expect ( file2 ) . toNotBe ( file ) ;
597
+ expect ( file2 ) . not . toBe ( file ) ;
600
598
expect ( file2 . symlink ) . toEqual ( file . symlink ) ;
601
599
done ( ) ;
602
600
} ) ;
@@ -611,11 +609,11 @@ describe('File', function() {
611
609
var file = new File ( options ) ;
612
610
var file2 = file . clone ( ) ;
613
611
614
- expect ( file2 ) . toNotBe ( file ) ;
612
+ expect ( file2 ) . not . toBe ( file ) ;
615
613
expect ( file2 . cwd ) . toEqual ( file . cwd ) ;
616
614
expect ( file2 . base ) . toEqual ( file . base ) ;
617
615
expect ( file2 . path ) . toEqual ( file . path ) ;
618
- expect ( file2 . contents ) . toNotExist ( ) ;
616
+ expect ( file2 . contents ) . toBeFalsy ( ) ;
619
617
done ( ) ;
620
618
} ) ;
621
619
@@ -633,8 +631,8 @@ describe('File', function() {
633
631
634
632
expect ( copy . stat . isFile ( ) ) . toEqual ( true ) ;
635
633
expect ( copy . stat . isDirectory ( ) ) . toEqual ( false ) ;
636
- expect ( file . stat ) . toBeAn ( fs . Stats ) ;
637
- expect ( copy . stat ) . toBeAn ( fs . Stats ) ;
634
+ expect ( file . stat ) . toBeInstanceOf ( fs . Stats ) ;
635
+ expect ( copy . stat ) . toBeInstanceOf ( fs . Stats ) ;
638
636
done ( ) ;
639
637
} ) ;
640
638
@@ -651,7 +649,7 @@ describe('File', function() {
651
649
652
650
expect ( copy . history [ 0 ] ) . toEqual ( options . path ) ;
653
651
copy . path = 'lol' ;
654
- expect ( file . path ) . toNotEqual ( copy . path ) ;
652
+ expect ( file . path ) . not . toEqual ( copy . path ) ;
655
653
done ( ) ;
656
654
} ) ;
657
655
@@ -667,12 +665,12 @@ describe('File', function() {
667
665
var file = new File ( options ) ;
668
666
var file2 = file . clone ( ) ;
669
667
670
- expect ( file2 ) . toNotBe ( file ) ;
668
+ expect ( file2 ) . not . toBe ( file ) ;
671
669
expect ( file2 . cwd ) . toEqual ( file . cwd ) ;
672
670
expect ( file2 . base ) . toEqual ( file . base ) ;
673
671
expect ( file2 . path ) . toEqual ( file . path ) ;
674
- expect ( file2 . custom ) . toNotBe ( file . custom ) ;
675
- expect ( file2 . custom . meta ) . toNotBe ( file . custom . meta ) ;
672
+ expect ( file2 . custom ) . not . toBe ( file . custom ) ;
673
+ expect ( file2 . custom . meta ) . not . toBe ( file . custom . meta ) ;
676
674
expect ( file2 . custom ) . toEqual ( file . custom ) ;
677
675
done ( ) ;
678
676
} ) ;
@@ -696,7 +694,7 @@ describe('File', function() {
696
694
var file2 = file . clone ( ) ;
697
695
698
696
expect ( file2 . history ) . toEqual ( history ) ;
699
- expect ( file2 . history ) . toNotBe ( file . history ) ;
697
+ expect ( file2 . history ) . not . toBe ( file . history ) ;
700
698
expect ( file2 . path ) . toEqual ( history [ 2 ] ) ;
701
699
done ( ) ;
702
700
} ) ;
@@ -714,21 +712,21 @@ describe('File', function() {
714
712
715
713
var file2 = file . clone ( ) ;
716
714
expect ( file2 . custom ) . toEqual ( file . custom ) ;
717
- expect ( file2 . custom ) . toNotBe ( file . custom ) ;
715
+ expect ( file2 . custom ) . not . toBe ( file . custom ) ;
718
716
expect ( file2 . custom . meta ) . toEqual ( file . custom . meta ) ;
719
- expect ( file2 . custom . meta ) . toNotBe ( file . custom . meta ) ;
717
+ expect ( file2 . custom . meta ) . not . toBe ( file . custom . meta ) ;
720
718
721
719
var file3 = file . clone ( true ) ;
722
720
expect ( file3 . custom ) . toEqual ( file . custom ) ;
723
- expect ( file3 . custom ) . toNotBe ( file . custom ) ;
721
+ expect ( file3 . custom ) . not . toBe ( file . custom ) ;
724
722
expect ( file3 . custom . meta ) . toEqual ( file . custom . meta ) ;
725
- expect ( file3 . custom . meta ) . toNotBe ( file . custom . meta ) ;
723
+ expect ( file3 . custom . meta ) . not . toBe ( file . custom . meta ) ;
726
724
727
725
var file4 = file . clone ( { deep : true } ) ;
728
726
expect ( file4 . custom ) . toEqual ( file . custom ) ;
729
- expect ( file4 . custom ) . toNotBe ( file . custom ) ;
727
+ expect ( file4 . custom ) . not . toBe ( file . custom ) ;
730
728
expect ( file4 . custom . meta ) . toEqual ( file . custom . meta ) ;
731
- expect ( file4 . custom . meta ) . toNotBe ( file . custom . meta ) ;
729
+ expect ( file4 . custom . meta ) . not . toBe ( file . custom . meta ) ;
732
730
733
731
var file5 = file . clone ( false ) ;
734
732
expect ( file5 . custom ) . toEqual ( file . custom ) ;
@@ -759,12 +757,12 @@ describe('File', function() {
759
757
var file = new ExtendedFile ( ) ;
760
758
var file2 = file . clone ( ) ;
761
759
762
- expect ( file2 ) . toNotBe ( file ) ;
760
+ expect ( file2 ) . not . toBe ( file ) ;
763
761
expect ( file2 . constructor ) . toBe ( ExtendedFile ) ;
764
- expect ( file2 ) . toBeAn ( ExtendedFile ) ;
765
- expect ( file2 ) . toBeA ( File ) ;
766
- expect ( ExtendedFile . prototype . isPrototypeOf ( file2 ) ) . toEqual ( true ) ;
767
- expect ( File . prototype . isPrototypeOf ( file2 ) ) . toEqual ( true ) ;
762
+ expect ( file2 ) . toBeInstanceOf ( ExtendedFile ) ;
763
+ expect ( file2 ) . toBeInstanceOf ( File ) ;
764
+ expect ( Object . prototype . isPrototypeOf . call ( ExtendedFile . prototype , file2 ) ) . toEqual ( true ) ;
765
+ expect ( Object . prototype . isPrototypeOf . call ( File . prototype , file2 ) ) . toEqual ( true ) ;
768
766
done ( ) ;
769
767
} ) ;
770
768
} ) ;
@@ -774,18 +772,14 @@ describe('File', function() {
774
772
it ( 'returns correct format when no contents and no path' , function ( done ) {
775
773
var file = new File ( ) ;
776
774
var expectation = '<File >' ;
777
- expect ( file . inspect ( ) ) . toEqual ( expectation ) ;
778
775
expect ( util . inspect ( file ) ) . toEqual ( expectation ) ;
779
- if ( util . inspect . custom ) {
780
- expect ( file [ util . inspect . custom ] ( ) ) . toEqual ( expectation ) ;
781
- }
782
776
done ( ) ;
783
777
} ) ;
784
778
785
779
it ( 'returns correct format when Buffer contents and no path' , function ( done ) {
786
780
var val = Buffer . from ( 'test' ) ;
787
781
var file = new File ( { contents : val } ) ;
788
- expect ( file . inspect ( ) ) . toEqual ( '<File <Buffer 74 65 73 74>>' ) ;
782
+ expect ( util . inspect ( file ) ) . toEqual ( '<File <Buffer 74 65 73 74>>' ) ;
789
783
done ( ) ;
790
784
} ) ;
791
785
@@ -797,7 +791,7 @@ describe('File', function() {
797
791
path : '/test/test.coffee' ,
798
792
contents : val ,
799
793
} ) ;
800
- expect ( file . inspect ( ) ) . toEqual ( '<File "test.coffee" <Buffer 74 65 73 74>>' ) ;
794
+ expect ( util . inspect ( file ) ) . toEqual ( '<File "test.coffee" <Buffer 74 65 73 74>>' ) ;
801
795
done ( ) ;
802
796
} ) ;
803
797
@@ -808,7 +802,7 @@ describe('File', function() {
808
802
path : '/test/test.coffee' ,
809
803
contents : from ( [ ] ) ,
810
804
} ) ;
811
- expect ( file . inspect ( ) ) . toEqual ( '<File "test.coffee" <CloneableStream>>' ) ;
805
+ expect ( util . inspect ( file ) ) . toEqual ( '<File "test.coffee" <CloneableStream>>' ) ;
812
806
done ( ) ;
813
807
} ) ;
814
808
@@ -819,7 +813,7 @@ describe('File', function() {
819
813
path : '/test/test.coffee' ,
820
814
contents : null ,
821
815
} ) ;
822
- expect ( file . inspect ( ) ) . toEqual ( '<File "test.coffee">' ) ;
816
+ expect ( util . inspect ( file ) ) . toEqual ( '<File "test.coffee">' ) ;
823
817
done ( ) ;
824
818
} ) ;
825
819
} ) ;
@@ -978,7 +972,7 @@ describe('File', function() {
978
972
cwd : '/foo' ,
979
973
base : '/bar' ,
980
974
} ) ;
981
- expect ( file . base ) . toNotEqual ( file . cwd ) ;
975
+ expect ( file . base ) . not . toEqual ( file . cwd ) ;
982
976
file . base = file . cwd ;
983
977
expect ( file . base ) . toEqual ( file . cwd ) ;
984
978
done ( ) ;
@@ -989,11 +983,11 @@ describe('File', function() {
989
983
cwd : '/foo' ,
990
984
base : '/bar' ,
991
985
} ) ;
992
- expect ( file . base ) . toNotEqual ( file . cwd ) ;
986
+ expect ( file . base ) . not . toEqual ( file . cwd ) ;
993
987
file . base = null ;
994
988
expect ( file . base ) . toEqual ( file . cwd ) ;
995
989
file . base = '/bar/' ;
996
- expect ( file . base ) . toNotEqual ( file . cwd ) ;
990
+ expect ( file . base ) . not . toEqual ( file . cwd ) ;
997
991
file . base = undefined ;
998
992
expect ( file . base ) . toEqual ( file . cwd ) ;
999
993
done ( ) ;
@@ -1205,7 +1199,7 @@ describe('File', function() {
1205
1199
var file = new File ( ) ;
1206
1200
1207
1201
function invalid ( ) {
1208
- var a = file . basename ;
1202
+ file . basename ;
1209
1203
}
1210
1204
1211
1205
expect ( invalid ) . toThrow ( 'No path specified! Can not get basename.' ) ;
@@ -1518,7 +1512,7 @@ describe('File', function() {
1518
1512
it ( 'throws on set with null path' , function ( done ) {
1519
1513
var file = new File ( ) ;
1520
1514
1521
- expect ( file . path ) . toNotExist ( ) ;
1515
+ expect ( file . path ) . toBeFalsy ( ) ;
1522
1516
expect ( file . history ) . toEqual ( [ ] ) ;
1523
1517
1524
1518
function invalid ( ) {
0 commit comments