mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
d747a471af
* Isolate each API entity * Improve code structure in API client and request mocks * Standardize on a request mock structure * Use helper for creating request mocks * Adds Request class to handle API requests
29 lines
719 B
JavaScript
29 lines
719 B
JavaScript
import expect from 'expect';
|
|
import nock from 'nock';
|
|
|
|
import Kolide from 'kolide';
|
|
import mocks from 'test/mocks';
|
|
|
|
const { statusLabels: statusLabelMocks } = mocks;
|
|
|
|
describe('Kolide - API client (status labels)', () => {
|
|
afterEach(() => {
|
|
nock.cleanAll();
|
|
Kolide.setBearerToken(null);
|
|
});
|
|
|
|
const bearerToken = 'valid-bearer-token';
|
|
|
|
describe('#getCounts', () => {
|
|
it('calls the appropriate endpoint with the correct parameters', () => {
|
|
const request = statusLabelMocks.getCounts.valid(bearerToken);
|
|
|
|
Kolide.setBearerToken(bearerToken);
|
|
return Kolide.statusLabels.getCounts()
|
|
.then(() => {
|
|
expect(request.isDone()).toEqual(true);
|
|
});
|
|
});
|
|
});
|
|
});
|