@@ -733,6 +733,91 @@ define(function (require, exports, module) {
733733 // TODO: More testing of error cases?
734734 } ) ;
735735
736+ describe ( "copyFile" , function ( ) {
737+ var error , complete ;
738+
739+ it ( "should copy a file" , function ( ) {
740+ var fileName = baseDir + "/file_one.txt" ,
741+ copyName = baseDir + "/file_one_copy.txt" ,
742+ copyCB = errSpy ( ) ,
743+ unlinkCB = errSpy ( ) ,
744+ statCB = statSpy ( ) ;
745+
746+ complete = false ;
747+
748+ // Verify new file does not exist
749+ runs ( function ( ) {
750+ brackets . fs . stat ( copyName , statCB ) ;
751+ } ) ;
752+
753+ waitsFor ( function ( ) { return statCB . wasCalled ; } , 1000 ) ;
754+
755+ runs ( function ( ) {
756+ expect ( statCB . error ) . toBe ( brackets . fs . ERR_NOT_FOUND ) ;
757+ } ) ;
758+
759+ // make the copy
760+ runs ( function ( ) {
761+ brackets . fs . copyFile ( fileName , copyName , copyCB ) ;
762+ } ) ;
763+
764+ waitsFor ( function ( ) { return copyCB . wasCalled ; } , 1000 ) ;
765+
766+ runs ( function ( ) {
767+ expect ( copyCB . error ) . toBe ( brackets . fs . NO_ERROR ) ;
768+ } ) ;
769+
770+ // Verify new file is found
771+ runs ( function ( ) {
772+ statCB = statSpy ( ) ;
773+ brackets . fs . stat ( copyName , statCB ) ;
774+ } ) ;
775+
776+ waitsFor ( function ( ) { return statCB . wasCalled ; } , 1000 ) ;
777+
778+ runs ( function ( ) {
779+ expect ( statCB . error ) . toBe ( brackets . fs . NO_ERROR ) ;
780+ } ) ;
781+
782+ // Verify the origin file still exists
783+ runs ( function ( ) {
784+ statCB = statSpy ( ) ;
785+ brackets . fs . stat ( fileName , statCB ) ;
786+ } ) ;
787+
788+ waitsFor ( function ( ) { return statCB . wasCalled ; } , 1000 ) ;
789+
790+ runs ( function ( ) {
791+ expect ( statCB . error ) . toBe ( brackets . fs . NO_ERROR ) ;
792+ } ) ;
793+
794+ // Delete the copy
795+ runs ( function ( ) {
796+ brackets . fs . unlink ( copyName , unlinkCB ) ;
797+ } ) ;
798+
799+ waitsFor ( function ( ) { return unlinkCB . wasCalled ; } , 1000 ) ;
800+
801+ runs ( function ( ) {
802+ expect ( unlinkCB . error ) . toBe ( brackets . fs . NO_ERROR ) ;
803+ } ) ;
804+
805+ } ) ;
806+ } ) ;
807+
808+ describe ( "specialDirectories" , function ( ) {
809+ it ( "should have an application support directory" , function ( ) {
810+ runs ( function ( ) {
811+ expect ( brackets . app . getApplicationSupportDirectory ( ) . length ) . toNotBe ( 0 ) ;
812+ } ) ;
813+ } ) ;
814+ it ( "should have a user documents directory" , function ( ) {
815+ runs ( function ( ) {
816+ expect ( brackets . app . getUserDocumentsDirectory ( ) . length ) . toNotBe ( 0 ) ;
817+ } ) ;
818+ } ) ;
819+ } ) ;
820+
736821 describe ( "moveToTrash" , function ( ) {
737822 var error , complete , isDirectory ;
738823
0 commit comments