File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-octal */
2
+ // vim: expandtab:ts=2:sw=2
3
+
4
+ const
5
+ assert = require ( 'assert' ) ,
6
+ tmp = require ( '../lib/tmp' ) ;
7
+
8
+ describe ( 'tmp' , function ( ) {
9
+ describe ( 'dirSync()' , function ( ) {
10
+ it ( 'with invalid template' , function ( ) {
11
+ try {
12
+ tmp . dirSync ( { template :'invalid' } ) ;
13
+ } catch ( err ) {
14
+ assert . equal ( err . message , 'Invalid template provided' , 'should have thrown the expected error' ) ;
15
+ }
16
+ } ) ;
17
+ } ) ;
18
+
19
+ describe ( 'fileSync()' , function ( ) {
20
+ it ( 'with invalid template' , function ( ) {
21
+ try {
22
+ tmp . fileSync ( { template :'invalid' } ) ;
23
+ } catch ( err ) {
24
+ assert . equal ( err . message , 'Invalid template provided' , 'should have thrown the expected error' ) ;
25
+ }
26
+ } ) ;
27
+ } ) ;
28
+ } ) ;
Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-octal */
2
+ // vim: expandtab:ts=2:sw=2
3
+
4
+ const
5
+ assert = require ( 'assert' ) ,
6
+ tmp = require ( '../lib/tmp' ) ;
7
+
8
+ describe ( 'tmp' , function ( ) {
9
+ describe ( 'dir()' , function ( ) {
10
+ it ( 'with invalid template' , function ( done ) {
11
+ tmp . dir ( { template :'invalid' } , function ( err ) {
12
+ if ( ! err ) return done ( new Error ( 'err expected' ) ) ;
13
+ try {
14
+ assert . equal ( err . message , 'Invalid template provided' , 'should have thrown the expected error' ) ;
15
+ } catch ( err2 ) {
16
+ done ( err ) ;
17
+ }
18
+ done ( ) ;
19
+ } ) ;
20
+ } ) ;
21
+ } ) ;
22
+
23
+ describe ( 'file()' , function ( ) {
24
+ it ( 'with invalid template' , function ( done ) {
25
+ tmp . file ( { template :'invalid' } , function ( err ) {
26
+ if ( ! err ) return done ( new Error ( 'err expected' ) ) ;
27
+ try {
28
+ assert . equal ( err . message , 'Invalid template provided' , 'should have thrown the expected error' ) ;
29
+ } catch ( err2 ) {
30
+ done ( err ) ;
31
+ }
32
+ done ( ) ;
33
+ } ) ;
34
+ } ) ;
35
+ } ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments