1515
1616'use strict' ;
1717
18- const proxyquire = require ( ` proxyquire` ) . noCallThru ( ) ;
19- const sinon = require ( ` sinon` ) ;
20- const test = require ( `ava` ) ;
21- const tools = require ( ` @google-cloud/nodejs-repo-tools` ) ;
18+ const proxyquire = require ( ' proxyquire' ) . noCallThru ( ) ;
19+ const sinon = require ( ' sinon' ) ;
20+ const assert = require ( 'assert' ) ;
21+ const tools = require ( ' @google-cloud/nodejs-repo-tools' ) ;
2222
2323function getSample ( ) {
24- const requestPromiseNative = sinon . stub ( ) . returns ( Promise . resolve ( ` test` ) ) ;
24+ const requestPromiseNative = sinon . stub ( ) . returns ( Promise . resolve ( ' test' ) ) ;
2525
2626 return {
27- program : proxyquire ( ` ../` , {
27+ program : proxyquire ( ' ../' , {
2828 'request-promise-native' : requestPromiseNative ,
2929 } ) ,
3030 mocks : {
@@ -33,65 +33,65 @@ function getSample() {
3333 } ;
3434}
3535
36- test . beforeEach ( tools . stubConsole ) ;
37- test . afterEach . always ( tools . restoreConsole ) ;
36+ beforeEach ( tools . stubConsole ) ;
37+ afterEach ( tools . restoreConsole ) ;
3838
39- test . serial ( ` should echo message` , t => {
39+ it ( ' should echo message' , ( ) => {
4040 const event = {
4141 data : {
42- myMessage : `hi` ,
42+ myMessage : 'hi' ,
4343 } ,
4444 } ;
4545 const sample = getSample ( ) ;
4646 const callback = sinon . stub ( ) ;
4747
4848 sample . program . helloWorld ( event , callback ) ;
4949
50- t . is ( console . log . callCount , 1 ) ;
51- t . deepEqual ( console . log . firstCall . args , [ event . data . myMessage ] ) ;
52- t . is ( callback . callCount , 1 ) ;
53- t . deepEqual ( callback . firstCall . args , [ ] ) ;
50+ assert . strictEqual ( console . log . callCount , 1 ) ;
51+ assert . deepStrictEqual ( console . log . firstCall . args , [ event . data . myMessage ] ) ;
52+ assert . strictEqual ( callback . callCount , 1 ) ;
53+ assert . deepStrictEqual ( callback . firstCall . args , [ ] ) ;
5454} ) ;
5555
56- test . serial ( ` should say no message was provided` , t => {
57- const error = new Error ( ` No message defined!` ) ;
56+ it ( ' should say no message was provided' , ( ) => {
57+ const error = new Error ( ' No message defined!' ) ;
5858 const callback = sinon . stub ( ) ;
5959 const sample = getSample ( ) ;
6060 sample . program . helloWorld ( { data : { } } , callback ) ;
6161
62- t . is ( callback . callCount , 1 ) ;
63- t . deepEqual ( callback . firstCall . args , [ error ] ) ;
62+ assert . strictEqual ( callback . callCount , 1 ) ;
63+ assert . deepStrictEqual ( callback . firstCall . args , [ error ] ) ;
6464} ) ;
6565
66- test . serial ( ` should make a promise request` , t => {
66+ it ( ' should make a promise request' , ( ) => {
6767 const sample = getSample ( ) ;
6868 const event = {
6969 data : {
70- endpoint : ` foo.com` ,
70+ endpoint : ' foo.com' ,
7171 } ,
7272 } ;
7373
7474 return sample . program . helloPromise ( event ) . then ( result => {
75- t . deepEqual ( sample . mocks . requestPromiseNative . firstCall . args , [
76- { uri : ` foo.com` } ,
75+ assert . deepStrictEqual ( sample . mocks . requestPromiseNative . firstCall . args , [
76+ { uri : ' foo.com' } ,
7777 ] ) ;
78- t . is ( result , ` test` ) ;
78+ assert . strictEqual ( result , ' test' ) ;
7979 } ) ;
8080} ) ;
8181
82- test . serial ( ` should return synchronously` , t => {
83- t . is (
82+ it ( ' should return synchronously' , ( ) => {
83+ assert . strictEqual (
8484 getSample ( ) . program . helloSynchronous ( {
8585 data : {
8686 something : true ,
8787 } ,
8888 } ) ,
89- ` Something is true!`
89+ ' Something is true!'
9090 ) ;
9191} ) ;
9292
93- test . serial ( ` should throw an error` , t => {
94- t . throws (
93+ it ( ' should throw an error' , ( ) => {
94+ assert . throws (
9595 ( ) => {
9696 getSample ( ) . program . helloSynchronous ( {
9797 data : {
@@ -100,6 +100,6 @@ test.serial(`should throw an error`, t => {
100100 } ) ;
101101 } ,
102102 Error ,
103- ` Something was not true!`
103+ ' Something was not true!'
104104 ) ;
105105} ) ;
0 commit comments