|
1 | 1 | import { BugSplatApiClient, Environment } from '@common'; |
2 | | -import { config } from '@spec/config'; |
3 | 2 | import { createFakeResponseBody } from '@spec/fakes/common/response'; |
4 | 3 |
|
| 4 | +const fakeBugSplatHost = 'https://fake.bugsplat.com'; |
| 5 | + |
5 | 6 | describe('BugSplatApiClient', () => { |
6 | 7 | const email = '[email protected]'; |
7 | 8 | const password = 'password'; |
@@ -44,7 +45,7 @@ describe('BugSplatApiClient', () => { |
44 | 45 | }); |
45 | 46 |
|
46 | 47 | it('should call fetch with correct route', () => { |
47 | | - expect((<any>client)._fetch).toHaveBeenCalledWith(`${config.host}${route}`, jasmine.anything()); |
| 48 | + expect((<any>client)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}${route}`, jasmine.anything()); |
48 | 49 | }); |
49 | 50 |
|
50 | 51 | describe('when environment is Browser', () => { |
@@ -94,7 +95,7 @@ describe('BugSplatApiClient', () => { |
94 | 95 | beforeEach(async () => result = await client.login(email, password)); |
95 | 96 |
|
96 | 97 | it('should call fetch with correct url', () => { |
97 | | - expect((<any>client)._fetch).toHaveBeenCalledWith(`${config.host}/api/authenticatev3`, jasmine.anything()); |
| 98 | + expect((<any>client)._fetch).toHaveBeenCalledWith(`${fakeBugSplatHost}/api/authenticatev3`, jasmine.anything()); |
98 | 99 | }); |
99 | 100 |
|
100 | 101 | it('should append email, password and Login properties to formData', () => { |
@@ -138,7 +139,7 @@ function createFakeBugSplatApiClient( |
138 | 139 | responseBody, |
139 | 140 | formData |
140 | 141 | ): BugSplatApiClient { |
141 | | - const client = new BugSplatApiClient(config.host, environment); |
| 142 | + const client = new BugSplatApiClient(fakeBugSplatHost, environment); |
142 | 143 | (<any>client)._fetch = jasmine.createSpy(); |
143 | 144 | (<any>client)._fetch.and.returnValue(responseBody); |
144 | 145 | (<any>client)._createFormData = () => formData; |
|
0 commit comments