forked from pmb0/nestjs-unleash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
features-client.spec.ts
33 lines (28 loc) · 915 Bytes
/
features-client.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Test, TestingModule } from '@nestjs/testing'
import { UnleashClient } from '../unleash-client'
import { UnleashFeaturesClient } from './features-client'
describe('UnleashFeaturesClient', () => {
let featuresClient: UnleashFeaturesClient
let unleashClient: jest.Mocked<UnleashClient>
beforeAll(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
UnleashFeaturesClient,
{
provide: UnleashClient,
useValue: {
get: jest.fn(),
},
},
],
}).compile()
featuresClient = module.get(UnleashFeaturesClient)
unleashClient = module.get(UnleashClient)
})
test('sendMetrics()', async () => {
await featuresClient.getFeatures()
expect(unleashClient.get).toHaveBeenCalledWith('/features', {
headers: { 'Accept-Encoding': 'gzip,deflate,compress' },
})
})
})