Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-17 18:09:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-17 18:09:03 +0300
commitcb840235d7fb4001dab266c614bd2cf59036fe18 (patch)
treeb2c8cfa706d4e2c20dfe6d6e7936deeb3025352c /spec/frontend/pipelines/time_ago_spec.js
parent359f9c9929177d6ea6c54c19b23959145f177a78 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines/time_ago_spec.js')
-rw-r--r--spec/frontend/pipelines/time_ago_spec.js69
1 files changed, 66 insertions, 3 deletions
diff --git a/spec/frontend/pipelines/time_ago_spec.js b/spec/frontend/pipelines/time_ago_spec.js
index 93aeb049434..412fb085e0b 100644
--- a/spec/frontend/pipelines/time_ago_spec.js
+++ b/spec/frontend/pipelines/time_ago_spec.js
@@ -5,6 +5,41 @@ import TimeAgo from '~/pipelines/components/pipelines_list/time_ago.vue';
describe('Timeago component', () => {
let wrapper;
+ const mutlipleStages = {
+ manual_actions: [
+ {
+ name: 'deploy_job',
+ path: '/root/one-stage-manual/-/jobs/1930/play',
+ playable: true,
+ scheduled: false,
+ },
+ ],
+ stages: [
+ {
+ name: 'deploy',
+ },
+ {
+ name: 'qa',
+ },
+ ],
+ };
+
+ const singleStageManual = {
+ manual_actions: [
+ {
+ name: 'deploy_job',
+ path: '/root/one-stage-manual/-/jobs/1930/play',
+ playable: true,
+ scheduled: false,
+ },
+ ],
+ stages: [
+ {
+ name: 'deploy',
+ },
+ ],
+ };
+
const createComponent = (props = {}) => {
wrapper = shallowMount(TimeAgo, {
propsData: {
@@ -30,6 +65,7 @@ describe('Timeago component', () => {
const duration = () => wrapper.find('.duration');
const finishedAt = () => wrapper.find('.finished-at');
const findInProgress = () => wrapper.find('[data-testid="pipeline-in-progress"]');
+ const findSkipped = () => wrapper.find('[data-testid="pipeline-skipped"]');
describe('with duration', () => {
beforeEach(() => {
@@ -46,7 +82,7 @@ describe('Timeago component', () => {
describe('without duration', () => {
beforeEach(() => {
- createComponent({ duration: 0, finished_at: '' });
+ createComponent({ ...singleStageManual, duration: 0, finished_at: '' });
});
it('should not render duration and timer svg', () => {
@@ -71,7 +107,7 @@ describe('Timeago component', () => {
describe('without finishedTime', () => {
beforeEach(() => {
- createComponent({ duration: 0, finished_at: '' });
+ createComponent({ ...singleStageManual, duration: 0, finished_at: '' });
});
it('should not render time and calendar icon', () => {
@@ -89,9 +125,36 @@ describe('Timeago component', () => {
`(
'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime',
({ durationTime, finishedAtTime, shouldShow }) => {
- createComponent({ duration: durationTime, finished_at: finishedAtTime });
+ createComponent({
+ ...mutlipleStages,
+ duration: durationTime,
+ finished_at: finishedAtTime,
+ });
expect(findInProgress().exists()).toBe(shouldShow);
+ expect(findSkipped().exists()).toBe(false);
+ },
+ );
+ });
+
+ describe('skipped', () => {
+ it.each`
+ durationTime | finishedAtTime | shouldShow
+ ${10} | ${'2017-04-26T12:40:23.277Z'} | ${false}
+ ${10} | ${''} | ${false}
+ ${0} | ${'2017-04-26T12:40:23.277Z'} | ${false}
+ ${0} | ${''} | ${true}
+ `(
+ 'progress state shown: $shouldShow when pipeline duration is $durationTime and finished_at is $finishedAtTime',
+ ({ durationTime, finishedAtTime, shouldShow }) => {
+ createComponent({
+ ...singleStageManual,
+ duration: durationTime,
+ finished_at: finishedAtTime,
+ });
+
+ expect(findSkipped().exists()).toBe(shouldShow);
+ expect(findInProgress().exists()).toBe(false);
},
);
});