Commit 270bc4f7 authored by Lennard Sprong's avatar Lennard Sprong
Browse files

feat: Add fallback text if CI status does not have illustration

parent 18ec6773
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,16 @@ describe('CI Status Metadata', () => {
      expect(result.name).toBe('Status Unknown');
    });

    it('returns fallback illustration for Failed status', () => {
      const result = getJobMetadata({
        ...job,
        status: 'failed',
      } as unknown as RestJob);

      expect(result.name).toBe('Failed');
      expect(result.illustration?.title).toBe('This job does not have a trace.');
    });

    it('returns "Delayed" for a scheduled job', () => {
      const result = getJobMetadata({
        ...job,
+8 −1
Original line number Diff line number Diff line
@@ -145,6 +145,13 @@ const FAILED_ALLOWED: CiStatusMetadata = {
  contextAction: 'retryable',
};

const COMMON: Partial<CiStatusMetadata> = {
  illustration: {
    image: 'assets/images/empty-job-skipped-md.svg',
    title: 'This job does not have a trace.',
  },
};

const ERASED: Partial<CiStatusMetadata> = {
  illustration: {
    image: 'assets/images/empty-projects-deleted-md.svg',
@@ -164,7 +171,7 @@ export const getJobMetadata = (job: RestJob): CiStatusMetadata => {
  if (job.erased_at) {
    data = { ...data, ...ERASED };
  }
  return data;
  return { ...COMMON, ...data };
};

export const getPipelineMetadata = (pipeline: RestPipeline): CiStatusMetadata =>