Properly set timeout for integration tests

This commit is contained in:
Jeffrey Morgan 2015-06-18 17:30:08 -07:00
Родитель 5f32883e91
Коммит 0dc304b37b
2 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -1,22 +1,24 @@
jest.autoMockOff(); jest.autoMockOff();
jasmine.getEnv().defaultTimeoutInterval = 60000;
let hubUtil = require('../src/utils/HubUtil'); let hubUtil = require('../src/utils/HubUtil');
let Promise = require('bluebird'); let Promise = require('bluebird');
jasmine.getEnv().DEFAULT_TIMEOUT_INTERVAL = 60000;
describe('HubUtil Integration Tests', () => { describe('HubUtil Integration Tests', () => {
describe('auth', () => { describe('auth', () => {
pit('successfully authenticates', () => { pit('successfully authenticates', () => {
return new Promise((resolve) => { return new Promise((resolve) => {
hubUtil.auth(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, (error, response, body) => { setTimeout(() => {
expect(response.statusCode).toBe(200); hubUtil.auth(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, (error, response, body) => {
expect(error).toBe(null); expect(response.statusCode).toBe(200);
expect(error).toBe(null);
let data = JSON.parse(body); let data = JSON.parse(body);
expect(data.token).toBeTruthy(); expect(data.token).toBeTruthy();
resolve(); resolve();
}); });
}, 5000);
}); });
}); });

Просмотреть файл

@ -1,7 +1,6 @@
jest.autoMockOff(); jest.autoMockOff();
// One minute timeout for integration tests jasmine.getEnv().defaultTimeoutInterval = 60000;
jasmine.getEnv().DEFAULT_TIMEOUT_INTERVAL = 60000;
let _ = require('underscore'); let _ = require('underscore');
let regHubUtil = require('../src/utils/RegHubUtil'); let regHubUtil = require('../src/utils/RegHubUtil');
@ -51,7 +50,6 @@ describe('RegHubUtil Integration Tests', () => {
return new Promise((resolve) => { return new Promise((resolve) => {
hubUtil.login(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, () => { hubUtil.login(process.env.INTEGRATION_USER, process.env.INTEGRATION_PASSWORD, () => {
regHubUtil.tags(`${process.env.INTEGRATION_USER}/test`, (error, tags) => { regHubUtil.tags(`${process.env.INTEGRATION_USER}/test`, (error, tags) => {
console.log(tags);
expect(error).toBeFalsy(); expect(error).toBeFalsy();
expect(tags.length).toEqual(1); expect(tags.length).toEqual(1);
expect(tags[0].name).toEqual('latest'); expect(tags[0].name).toEqual('latest');