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 13, 2019
1 parent c4c5740 commit d2d32a9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 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
8 changes: 4 additions & 4 deletions frontend/src/pages/RunList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,19 @@ describe('RunList', () => {
});

it('renders pipeline name as link to its details page', () => {
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', id: 'pipeline-id', showLink: false }, id: 'run-id' })).toMatchSnapshot();
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', id: 'pipeline-id', pipelineFromSpec: false }, id: 'run-id' })).toMatchSnapshot();
});

it('handles no pipeline id given', () => {
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', showLink: false }, id: 'run-id' })).toMatchSnapshot();
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', pipelineFromSpec: false }, id: 'run-id' })).toMatchSnapshot();
});

it('shows "View pipeline" button if pipeline is embedded in run', () => {
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', id: 'pipeline-id', showLink: true }, id: 'run-id' })).toMatchSnapshot();
expect(getMountedInstance()._pipelineCustomRenderer({ value: { displayName: 'test pipeline', id: 'pipeline-id', pipelineFromSpec: true }, id: 'run-id' })).toMatchSnapshot();
});

it('handles no pipeline name', () => {
expect(getMountedInstance()._pipelineCustomRenderer({ value: { /* no displayName */ showLink: true }, id: 'run-id' })).toMatchSnapshot();
expect(getMountedInstance()._pipelineCustomRenderer({ value: { /* no displayName */ pipelineFromSpec: true }, id: 'run-id' })).toMatchSnapshot();
});

it('renders pipeline name as link to its details page', () => {
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
2 changes: 1 addition & 1 deletion frontend/src/pages/__snapshots__/RunList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7955,7 +7955,7 @@ exports[`RunList shows pipeline name 1`] = `
Object {
"displayName": "test pipeline",
"id": "test-pipeline-id",
"showLink": false,
"pipelineFromSpec": false,
},
undefined,
"-",
Expand Down

0 comments on commit d2d32a9

Please sign in to comment.