Show a project's roadmap, releases and first issues from TaskStream
When a project has a board in TaskStream, its page lists the epics with their dates and progress, the releases with their notes, the sprint under way and the tickets meant for newcomers, linking to the board. TaskStream being slow or down only leaves those sections out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
47
landing/src/app/core/taskstream.spec.ts
Normal file
47
landing/src/app/core/taskstream.spec.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { boardLink, fetchShowcase, hasContent } from './taskstream';
|
||||
|
||||
const showcase = {
|
||||
project: { id: 'p', key: 'WEB', name: 'Web', description: null },
|
||||
activeSprint: null,
|
||||
roadmap: [],
|
||||
releases: [],
|
||||
goodFirst: [
|
||||
{ key: 'WEB-9', title: 'Typo', type: 'TASK', path: '/p/WEB/issues/WEB-9' },
|
||||
],
|
||||
};
|
||||
|
||||
describe('TaskStream showcase', () => {
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
it('reads a showcase, and goes without it when TaskStream fails', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(async () => new Response(JSON.stringify(showcase))),
|
||||
);
|
||||
expect(await fetchShowcase('https://api.ts/showcase')).toEqual(showcase);
|
||||
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(async () => new Response('nope', { status: 404 })),
|
||||
);
|
||||
expect(await fetchShowcase('https://api.ts/showcase')).toBeNull();
|
||||
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
vi.fn(async () => {
|
||||
throw new Error('down');
|
||||
}),
|
||||
);
|
||||
expect(await fetchShowcase('https://api.ts/showcase')).toBeNull();
|
||||
});
|
||||
|
||||
it('builds links into the board and knows an empty one', () => {
|
||||
expect(
|
||||
boardLink('https://taskstream.pireon.dev/', '/p/WEB/issues/WEB-9'),
|
||||
).toBe('https://taskstream.pireon.dev/p/WEB/issues/WEB-9');
|
||||
expect(hasContent(showcase)).toBe(true);
|
||||
expect(hasContent({ ...showcase, goodFirst: [] })).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user