@@ -6,16 +6,16 @@ const {btoa, atob} = require('./base64');
66
77test ( 'btoa: browser' , ( t ) => {
88 const btoaOriginal = global . btoa ;
9+ const btoaStub = stub ( ) ;
910 const str = 'hello' ;
1011
11- global . btoa = stub ( ) ;
12+ global . btoa = btoaStub ;
1213
1314 btoa ( str ) ;
15+ global . btoa = btoaOriginal ;
1416
15- t . calledWith ( global . btoa , [ str ] , 'should call global.btoa' ) ;
17+ t . calledWith ( btoaStub , [ str ] , 'should call global.btoa' ) ;
1618 t . end ( ) ;
17-
18- global . btoa = btoaOriginal ;
1919} ) ;
2020
2121test ( 'btoa: node' , ( t ) => {
@@ -30,16 +30,18 @@ test('btoa: node', (t) => {
3030
3131test ( 'atob: browser' , ( t ) => {
3232 const atobOriginal = global . atob ;
33+ const atobStub = stub ( ) ;
34+
3335 const str = 'hello' ;
3436
35- global . atob = stub ( ) ;
37+ global . atob = atobStub ;
3638
3739 atob ( str ) ;
3840
39- t . calledWith ( global . atob , [ str ] , 'should call global.btoa' ) ;
40- t . end ( ) ;
41-
4241 global . atob = atobOriginal ;
42+
43+ t . calledWith ( atobStub , [ str ] , 'should call global.btoa' ) ;
44+ t . end ( ) ;
4345} ) ;
4446
4547test ( 'atob: node' , ( t ) => {
0 commit comments