@@ -14,7 +14,7 @@ const command: Command = require('./convert-pdf');
1414describe ( commands . CONVERT_PDF , ( ) => {
1515 let log : string [ ] ;
1616 let logger : Logger ;
17- let rmSyncStub : sinon . SinonStub ;
17+ let unlinkSyncStub : sinon . SinonStub ;
1818 const mockPdfFile = 'pdf' ;
1919 let pdfConvertResponseStream : PassThrough ;
2020 let pdfConvertWriteStream : PassThrough ;
@@ -23,7 +23,7 @@ describe(commands.CONVERT_PDF, () => {
2323 sinon . stub ( auth , 'restoreAuth' ) . callsFake ( ( ) => Promise . resolve ( ) ) ;
2424 sinon . stub ( appInsights , 'trackEvent' ) . callsFake ( ( ) => { } ) ;
2525 auth . service . connected = true ;
26- rmSyncStub = sinon . stub ( fs , 'rmSync ' ) . callsFake ( _ => { } ) ;
26+ unlinkSyncStub = sinon . stub ( fs , 'unlinkSync ' ) . callsFake ( _ => { } ) ;
2727 } ) ;
2828
2929 beforeEach ( ( ) => {
@@ -53,7 +53,7 @@ describe(commands.CONVERT_PDF, () => {
5353 } ) ;
5454
5555 afterEach ( ( ) => {
56- rmSyncStub . resetHistory ( ) ;
56+ unlinkSyncStub . resetHistory ( ) ;
5757 Utils . restore ( [
5858 request . delete ,
5959 request . get ,
@@ -70,7 +70,7 @@ describe(commands.CONVERT_PDF, () => {
7070 Utils . restore ( [
7171 auth . restoreAuth ,
7272 appInsights . trackEvent ,
73- fs . rmSync
73+ fs . unlinkSync
7474 ] ) ;
7575 auth . service . connected = false ;
7676 } ) ;
@@ -159,7 +159,7 @@ describe(commands.CONVERT_PDF, () => {
159159 try {
160160 assert . strictEqual ( typeof err , 'undefined' ) ;
161161 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
162- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
162+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
163163 done ( ) ;
164164 }
165165 catch ( e ) {
@@ -236,7 +236,7 @@ describe(commands.CONVERT_PDF, () => {
236236 try {
237237 assert . strictEqual ( typeof err , 'undefined' ) ;
238238 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
239- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
239+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
240240 done ( ) ;
241241 }
242242 catch ( e ) {
@@ -313,7 +313,7 @@ describe(commands.CONVERT_PDF, () => {
313313 try {
314314 assert . strictEqual ( typeof err , 'undefined' ) ;
315315 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
316- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
316+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
317317 done ( ) ;
318318 }
319319 catch ( e ) {
@@ -390,7 +390,7 @@ describe(commands.CONVERT_PDF, () => {
390390 try {
391391 assert . strictEqual ( typeof err , 'undefined' ) ;
392392 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
393- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
393+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
394394 done ( ) ;
395395 }
396396 catch ( e ) {
@@ -459,7 +459,7 @@ describe(commands.CONVERT_PDF, () => {
459459 try {
460460 assert . strictEqual ( typeof err , 'undefined' ) ;
461461 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
462- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
462+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
463463 done ( ) ;
464464 }
465465 catch ( e ) {
@@ -528,7 +528,7 @@ describe(commands.CONVERT_PDF, () => {
528528 try {
529529 assert . strictEqual ( typeof err , 'undefined' ) ;
530530 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
531- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
531+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
532532 done ( ) ;
533533 }
534534 catch ( e ) {
@@ -597,7 +597,7 @@ describe(commands.CONVERT_PDF, () => {
597597 try {
598598 assert . strictEqual ( typeof err , 'undefined' ) ;
599599 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
600- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
600+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
601601 done ( ) ;
602602 }
603603 catch ( e ) {
@@ -662,7 +662,7 @@ describe(commands.CONVERT_PDF, () => {
662662 try {
663663 assert . strictEqual ( typeof err , 'undefined' ) ;
664664 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
665- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
665+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
666666 done ( ) ;
667667 }
668668 catch ( e ) {
@@ -727,7 +727,7 @@ describe(commands.CONVERT_PDF, () => {
727727 try {
728728 assert . strictEqual ( typeof err , 'undefined' ) ;
729729 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
730- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
730+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
731731 done ( ) ;
732732 }
733733 catch ( e ) {
@@ -792,7 +792,7 @@ describe(commands.CONVERT_PDF, () => {
792792 try {
793793 assert . strictEqual ( typeof err , 'undefined' ) ;
794794 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
795- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
795+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
796796 done ( ) ;
797797 }
798798 catch ( e ) {
@@ -857,7 +857,7 @@ describe(commands.CONVERT_PDF, () => {
857857 try {
858858 assert . strictEqual ( typeof err , 'undefined' ) ;
859859 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
860- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
860+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
861861 done ( ) ;
862862 }
863863 catch ( e ) {
@@ -926,7 +926,7 @@ describe(commands.CONVERT_PDF, () => {
926926 try {
927927 assert . strictEqual ( typeof err , 'undefined' ) ;
928928 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
929- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
929+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
930930 done ( ) ;
931931 }
932932 catch ( e ) {
@@ -997,7 +997,7 @@ describe(commands.CONVERT_PDF, () => {
997997 try {
998998 assert . strictEqual ( typeof err , 'undefined' ) ;
999999 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1000- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1000+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
10011001 done ( ) ;
10021002 }
10031003 catch ( e ) {
@@ -1128,7 +1128,7 @@ describe(commands.CONVERT_PDF, () => {
11281128 try {
11291129 assert . strictEqual ( typeof err , 'undefined' ) ;
11301130 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1131- assert ( rmSyncStub . calledOnce , 'Did not remove local file' ) ;
1131+ assert ( unlinkSyncStub . calledOnce , 'Did not remove local file' ) ;
11321132 done ( ) ;
11331133 }
11341134 catch ( e ) {
@@ -1200,7 +1200,7 @@ describe(commands.CONVERT_PDF, () => {
12001200 } , ( err ?: any ) => {
12011201 try {
12021202 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'Drive not found' ) ) ) ;
1203- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1203+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
12041204 done ( ) ;
12051205 }
12061206 catch ( e ) {
@@ -1274,7 +1274,7 @@ describe(commands.CONVERT_PDF, () => {
12741274 } , ( err ?: any ) => {
12751275 try {
12761276 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'Error: Request failed with status code 404' ) ) ) ;
1277- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1277+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
12781278 done ( ) ;
12791279 }
12801280 catch ( e ) {
@@ -1357,7 +1357,7 @@ describe(commands.CONVERT_PDF, () => {
13571357 } , ( err ?: any ) => {
13581358 try {
13591359 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( "Error: ENOENT: no such file or directory, open './foo/file.pdf'" ) ) ) ;
1360- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1360+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
13611361 done ( ) ;
13621362 }
13631363 catch ( e ) {
@@ -1445,7 +1445,7 @@ describe(commands.CONVERT_PDF, () => {
14451445 try {
14461446 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'An error has occurred' ) ) ) ;
14471447 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1448- assert ( rmSyncStub . calledOnce , `Didn't remove the local file` ) ;
1448+ assert ( unlinkSyncStub . calledOnce , `Didn't remove the local file` ) ;
14491449 done ( ) ;
14501450 }
14511451 catch ( e ) {
@@ -1526,7 +1526,7 @@ describe(commands.CONVERT_PDF, () => {
15261526 try {
15271527 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'An error has occurred' ) ) ) ;
15281528 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1529- assert ( rmSyncStub . calledOnce , `Didn't remove the local file` ) ;
1529+ assert ( unlinkSyncStub . calledOnce , `Didn't remove the local file` ) ;
15301530 done ( ) ;
15311531 }
15321532 catch ( e ) {
@@ -1632,7 +1632,7 @@ describe(commands.CONVERT_PDF, () => {
16321632 try {
16331633 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'An error has occurred' ) ) ) ;
16341634 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1635- assert ( rmSyncStub . calledOnce , `Didn't remove the local file` ) ;
1635+ assert ( unlinkSyncStub . calledOnce , `Didn't remove the local file` ) ;
16361636 done ( ) ;
16371637 }
16381638 catch ( e ) {
@@ -1701,7 +1701,7 @@ describe(commands.CONVERT_PDF, () => {
17011701 try {
17021702 assert . strictEqual ( JSON . stringify ( err ) , JSON . stringify ( new CommandError ( 'An error has occurred' ) ) ) ;
17031703 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1704- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1704+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
17051705 done ( ) ;
17061706 }
17071707 catch ( e ) {
@@ -1821,8 +1821,8 @@ describe(commands.CONVERT_PDF, () => {
18211821 } ) ;
18221822
18231823 sinon . stub ( fs , 'readFileSync' ) . callsFake ( ( ) => 'abc' ) ;
1824- Utils . restore ( fs . rmSync ) ;
1825- rmSyncStub = sinon . stub ( fs , 'rmSync ' ) . callsFake ( _ => { throw 'An error has occurred' ; } ) ;
1824+ Utils . restore ( fs . unlinkSync ) ;
1825+ unlinkSyncStub = sinon . stub ( fs , 'unlinkSync ' ) . callsFake ( _ => { throw 'An error has occurred' ; } ) ;
18261826
18271827 command . action ( logger , {
18281828 options : {
@@ -1834,7 +1834,7 @@ describe(commands.CONVERT_PDF, () => {
18341834 try {
18351835 assert . strictEqual ( err , 'An error has occurred' ) ;
18361836 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1837- assert ( rmSyncStub . calledOnce , 'Did not remove local file' ) ;
1837+ assert ( unlinkSyncStub . calledOnce , 'Did not remove local file' ) ;
18381838 done ( ) ;
18391839 }
18401840 catch ( e ) {
@@ -1914,7 +1914,7 @@ describe(commands.CONVERT_PDF, () => {
19141914 try {
19151915 assert . strictEqual ( typeof err , 'undefined' ) ;
19161916 assert . strictEqual ( Buffer . from ( pdfConvertWriteStream . read ( ) ) . toString ( ) , mockPdfFile , 'Invalid PDF contents' ) ;
1917- assert ( rmSyncStub . notCalled , 'Removed local file' ) ;
1917+ assert ( unlinkSyncStub . notCalled , 'Removed local file' ) ;
19181918 done ( ) ;
19191919 }
19201920 catch ( e ) {
0 commit comments