UNPKG

828 BJavaScriptView Raw
1import Credentials from "../lib/Credentials";
2import HttpClient from "../lib/HttpClient";
3import NullLogger from "../lib/ConsoleLogger.js";
4
5import sinon from "sinon";
6import chai, { expect } from "chai";
7import sinonChai from "sinon-chai";
8import nexmoChai from "./NexmoChai";
9chai.use(sinonChai);
10chai.use(nexmoChai);
11
12const TestUtils = {
13 getCredentials: function() {
14 var creds = Credentials.parse({
15 apiKey: "myKey",
16 apiSecret: "mySecret"
17 });
18
19 // Overwrite JWT generation for tests
20 creds.generateJwt = function() {
21 return "ThisIsAJWT";
22 };
23
24 return creds;
25 },
26 getHttpClient: function() {
27 const httpClient = new HttpClient(
28 {
29 logger: new NullLogger()
30 },
31 this.getCredentials()
32 );
33
34 return httpClient;
35 }
36};
37
38export { TestUtils, expect, sinon };