kitematic/__integration__/HubUtil-integration.js

33 строки
956 B
JavaScript
Исходник Постоянная ссылка Обычный вид История

jest.autoMockOff();
jasmine.getEnv().defaultTimeoutInterval = 60000;
2015-05-28 00:20:44 +03:00
let hubUtil = require('../src/utils/HubUtil');
let Promise = require('bluebird');
2015-05-28 00:20:44 +03:00
describe('HubUtil Integration Tests', () => {
describe('auth', () => {
pit('successfully authenticates', () => {
return new Promise((resolve) => {
hubUtil.auth(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, (error, response, body) => {
expect(response.statusCode).toBe(200);
expect(error).toBe(null);
let data = JSON.parse(body);
expect(data.token).toBeTruthy();
resolve();
});
2015-05-28 00:20:44 +03:00
});
});
2015-05-28 00:20:44 +03:00
pit('provides a 401 if credentials are incorrect', () => {
return new Promise((resolve) => {
hubUtil.auth(process.env.INTEGRATION_USER, 'incorrectpassword', (error, response) => {
expect(response.statusCode).toBe(401);
resolve();
});
});
});
});
});