Skip to content

Commit

Permalink
Update, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjbauer committed Aug 15, 2019
1 parent d38db17 commit 627667f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions frontend/src/lib/Utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Utils', () => {

it('computes seconds', () => {
const run = {
created_at: new Date(2018, 1, 2, 3, 55, 30).toISOString(),
created_at: new Date(2018, 1, 3, 3, 55, 30).toISOString(),
finished_at: new Date(2018, 1, 3, 3, 56, 25).toISOString(),
status: NodePhase.SUCCEEDED,
} as any;
Expand All @@ -123,29 +123,29 @@ describe('Utils', () => {

it('computes minutes/seconds', () => {
const run = {
created_at: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
created_at: new Date(2018, 1, 3, 3, 55, 10).toISOString(),
finished_at: new Date(2018, 1, 3, 3, 59, 25).toISOString(),
status: NodePhase.SUCCEEDED,
} as any;
expect(getRunDuration(run)).toBe('0:04:15');
});

it('computes days/minutes/seconds', () => {
it('computes hours/minutes/seconds', () => {
const run = {
created_at: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
finished_at: new Date(2018, 1, 3, 4, 55, 10).toISOString(),
status: NodePhase.SUCCEEDED,
} as any;
expect(getRunDuration(run)).toBe('1:00:00');
expect(getRunDuration(run)).toBe('25:00:00');
});

it('computes padded days/minutes/seconds', () => {
it('computes padded hours/minutes/seconds', () => {
const run = {
created_at: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
finished_at: new Date(2018, 1, 3, 4, 56, 11).toISOString(),
status: NodePhase.SUCCEEDED,
} as any;
expect(getRunDuration(run)).toBe('1:01:01');
expect(getRunDuration(run)).toBe('25:01:01');
});

it('shows negative sign if start date is after end date', () => {
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('Utils', () => {
const workflow = {
status: {
finishedAt: new Date(2018, 1, 3, 3, 56, 25).toISOString(),
startedAt: new Date(2018, 1, 2, 3, 55, 30).toISOString(),
startedAt: new Date(2018, 1, 3, 3, 55, 30).toISOString(),
}
} as any;
expect(getRunDurationFromWorkflow(workflow)).toBe('0:00:55');
Expand All @@ -200,27 +200,27 @@ describe('Utils', () => {
const workflow = {
status: {
finishedAt: new Date(2018, 1, 3, 3, 59, 25).toISOString(),
startedAt: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
startedAt: new Date(2018, 1, 3, 3, 55, 10).toISOString(),
}
} as any;
expect(getRunDurationFromWorkflow(workflow)).toBe('0:04:15');
});

it('computes days/minutes/seconds run time if status is provided', () => {
it('computes hours/minutes/seconds run time if status is provided', () => {
const workflow = {
status: {
finishedAt: new Date(2018, 1, 3, 4, 55, 10).toISOString(),
startedAt: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
startedAt: new Date(2018, 1, 3, 3, 55, 10).toISOString(),
}
} as any;
expect(getRunDurationFromWorkflow(workflow)).toBe('1:00:00');
});

it('computes padded days/minutes/seconds run time if status is provided', () => {
it('computes padded hours/minutes/seconds run time if status is provided', () => {
const workflow = {
status: {
finishedAt: new Date(2018, 1, 3, 4, 56, 11).toISOString(),
startedAt: new Date(2018, 1, 2, 3, 55, 10).toISOString(),
startedAt: new Date(2018, 1, 3, 3, 55, 10).toISOString(),
}
} as any;
expect(getRunDurationFromWorkflow(workflow)).toBe('1:01:01');
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/__snapshots__/RunDetails.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ exports[`RunDetails shows run config fields - handles no description 1`] = `
],
Array [
"Duration",
"1:01:01",
"25:01:01",
],
]
}
Expand Down Expand Up @@ -1896,7 +1896,7 @@ exports[`RunDetails shows run config fields - handles no metadata 1`] = `
],
Array [
"Duration",
"1:01:01",
"25:01:01",
],
]
}
Expand Down Expand Up @@ -1957,7 +1957,7 @@ exports[`RunDetails shows run config fields 1`] = `
],
Array [
"Duration",
"1:01:01",
"25:01:01",
],
]
}
Expand Down

0 comments on commit 627667f

Please sign in to comment.