Skip to content

Commit ea7e34a

Browse files
SAN-6094 Fixing bug where i thought we were using epoche and were using 0 BCE instead.
1 parent 9b310c0 commit ea7e34a

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

client/services/calculateHistoricalTestResults.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require('app')
66
var PASSED = 'passed';
77
var FAILED = 'failed';
88
var UNKNOWN = 'unknown';
9+
var jesusBirthday = '0001-01-01T00:00:00Z';
910

1011
function calculateHistoricalTestResult(
1112
keypather
@@ -22,15 +23,13 @@ function calculateHistoricalTestResult(
2223
},
2324
addResults: function (tests) {
2425
tests.forEach(function(test) {
25-
if (test && keypather.get(test, 'build.stop.valueOf()') !== 0) {
26+
if (test && keypather.get(test, 'build.stop') !== jesusBirthday) {
2627
if (keypather.get(test, 'build.failed') || keypather.get(test, 'application.exitCode') > 0) {
2728
test.testState = FAILED;
28-
} else if (keypather.get(test,'application.exitCode') === 0 &&
29-
keypather.get(test,'application.stop.valueOf()') !== 0) {
29+
} else if (keypather.get(test,'application.exitCode') === 0 && keypather.get(test,'application.stop') !== jesusBirthday) {
3030
test.testState = PASSED;
3131
}
3232
}
33-
3433
if (!test.testState) {
3534
test.testState = UNKNOWN;
3635
}

test/unit/directives/components/lists/branchTestListController.unit.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ describe('BranchTestListController'.bold.underline.blue, function () {
1818
var newCommit;
1919
var appCodeVersion;
2020

21+
var jesusBirthday = '0001-01-01T00:00:00Z';
22+
2123
function initialize() {
2224
appCodeVersion = {
2325
attrs: {
@@ -74,7 +76,7 @@ describe('BranchTestListController'.bold.underline.blue, function () {
7476
{
7577
commitSha: '1',
7678
build: {
77-
stop: new Date(0),
79+
stop: jesusBirthday,
7880
failed: false
7981
}
8082
},
@@ -103,7 +105,7 @@ describe('BranchTestListController'.bold.underline.blue, function () {
103105
},
104106
application: {
105107
exitCode: 0,
106-
stop: new Date(0)
108+
stop: jesusBirthday
107109
}
108110
},
109111
{
@@ -178,13 +180,13 @@ describe('BranchTestListController'.bold.underline.blue, function () {
178180
$scope.$digest();
179181
// No test found
180182
expect(branch.commits.models[0].test).to.equal(null);
181-
// Test found but build exit time of epoch
183+
// Test found but build exit time of jessus birthday
182184
expect(branch.commits.models[1].test).to.equal('unknown');
183185
// Build failed is true
184186
expect(branch.commits.models[2].test).to.equal('failed');
185187
// // Build passed but exit code > 0
186188
expect(branch.commits.models[3].test).to.equal('failed');
187-
// Application stop is epoch
189+
// Application stop is jessus birthday
188190
expect(branch.commits.models[4].test).to.equal('unknown');
189191
expect(branch.commits.models[5].test).to.equal('passed');
190192
});

test/unit/services/calculateHistoricalTestResults.unit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
describe('calculateHistoricalTestResult'.bold.underline.blue, function () {
44
var calculateHistoricalTestResult;
55
var keypather;
6+
var jesusBirthday = '0001-01-01T00:00:00Z';
67

78
function setup() {
89
angular.mock.module('app');
@@ -21,7 +22,7 @@ describe('calculateHistoricalTestResult'.bold.underline.blue, function () {
2122
it('addResults build stop epoch', function () {
2223
var tests = [{
2324
build: {
24-
stop: new Date(0),
25+
stop: jesusBirthday,
2526
failed: false
2627
},
2728
application: {
@@ -74,7 +75,7 @@ describe('calculateHistoricalTestResult'.bold.underline.blue, function () {
7475
},
7576
application: {
7677
exitCode: 0,
77-
stop: new Date(0)
78+
stop: jesusBirthday
7879
}
7980
}];
8081
calculateHistoricalTestResult.addResults(tests);

0 commit comments

Comments
 (0)