Skip to content

Commit

Permalink
Merge pull request #1348 from HubSpot/testing
Browse files Browse the repository at this point in the history
Add tests for SingularityUI
  • Loading branch information
Tom Petr committed Nov 21, 2016
2 parents 872fc1f + 5bda218 commit 1aa39fa
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SingularityUI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
},
"bin": {},
"scripts": {
"start": "gulp serve"
"start": "gulp serve",
"test": "mocha --compilers js:babel-core/register test/index.test",
"test:watch": "npm test -- --watch"
},
"dependencies": {
"bootstrap": "~3.3.0",
Expand Down Expand Up @@ -76,6 +78,7 @@
"eslint-config-hubspot": "^6.2.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-react": "^4.2.3",
"expect": "^1.20.2",
"exports-loader": "^0.6.3",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
Expand All @@ -84,6 +87,7 @@
"gulp-sass": "^2.3.1",
"gulp-stylus": "^2.3.0",
"gulp-util": "^3.0.7",
"mocha": "^3.1.2",
"nib": "^1.1.0",
"streamqueue": "^1.1.1",
"webpack": "~1.12.14",
Expand Down
10 changes: 10 additions & 0 deletions SingularityUI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
</configuration>
</execution>

<execution>
<id>npm test</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>test</arguments>
</configuration>
</execution>

<execution>
<id>gulp build</id>
<goals>
Expand Down
3 changes: 3 additions & 0 deletions SingularityUI/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'core-js/es6';

import './utils.test';
20 changes: 20 additions & 0 deletions SingularityUI/test/utils.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import expect from 'expect';

import Utils from '../app/utils';

describe('Utils', () => {
describe('getTaskDataFromTaskId()', () => {
it('should grab all fields from a valid task id', () => {
expect(Utils.getTaskDataFromTaskId('InternalEmailCronJobs-fsgj-92_13_3-1479418265674-1-hostname.example.com-us_east_1e'))
.toEqual({
id: 'InternalEmailCronJobs-fsgj-92_13_3-1479418265674-1-hostname.example.com-us_east_1e',
rackId: 'us_east_1e',
host: 'hostname.example.com',
instanceNo: '1',
startedAt: '1479418265674',
deployId: '92_13_3',
requestId: 'InternalEmailCronJobs-fsgj'
});
});
});
});

0 comments on commit 1aa39fa

Please sign in to comment.