1
- // Copyright 2016, Google, Inc.
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
1
+ /**
2
+ * Copyright 2017, Google, Inc.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
13
15
14
16
'use strict' ;
15
17
16
- require ( `../../test/_setup` ) ;
17
-
18
18
const proxyquire = require ( `proxyquire` ) . noPreserveCache ( ) ;
19
+ const test = require ( `ava` ) ;
20
+ const tools = require ( `@google-cloud/nodejs-repo-tools` ) ;
21
+
19
22
process . env . MAILJET_API_KEY = `foo` ;
20
23
process . env . MAILJET_API_SECRET = `bar` ;
21
24
22
- test . beforeEach ( stubConsole ) ;
23
- test . afterEach . always ( restoreConsole ) ;
25
+ test . beforeEach ( tools . stubConsole ) ;
26
+ test . afterEach . always ( tools . restoreConsole ) ;
24
27
25
28
test . cb ( `should send an email` , ( t ) => {
26
29
proxyquire ( `../mailjet` , {
@@ -35,7 +38,7 @@ test.cb(`should send an email`, (t) => {
35
38
subject : `test email from Node.js on Google Cloud Platform` ,
36
39
text : `Hello!\n\nThis a test email from Node.js.`
37
40
} ) ;
38
- cb ( `done` ) ;
41
+ cb ( null , `done` ) ;
39
42
t . end ( ) ;
40
43
}
41
44
} ;
0 commit comments