Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for SingularityUI #1348

Merged
merged 2 commits into from
Nov 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
});
});
});
});