|
1 | | -import { afterAll, beforeAll, test } from 'vitest'; |
| 1 | +import { describe, test } from 'vitest'; |
2 | 2 | import type { AgileModels } from '@jirajs'; |
3 | 3 | import { Constants } from '@tests/integration/constants'; |
4 | 4 | import { |
5 | | - createAgileProject, |
6 | | - deleteAgileProject, |
7 | 5 | getAgileClient, |
8 | 6 | getVersion3Client, |
9 | 7 | } from '@tests/integration/utils'; |
10 | 8 |
|
11 | | -const client = getAgileClient(); |
| 9 | +describe.sequential('Sprint', () => { |
| 10 | + const client = getAgileClient(); |
12 | 11 |
|
13 | | -let board: AgileModels.Board | undefined; |
14 | | -let sprint: AgileModels.Sprint; |
| 12 | + let board: AgileModels.Board | undefined; |
| 13 | + let sprint: AgileModels.Sprint; |
15 | 14 |
|
16 | | -beforeAll(async () => { |
17 | | - await createAgileProject(); |
18 | | -}); |
19 | | - |
20 | | -afterAll(async () => { |
21 | | - await deleteAgileProject(); |
22 | | -}); |
23 | | - |
24 | | -test.sequential.skip('should create new sprint', async ({ expect }) => { |
25 | | - const boards = await client.board.getAllBoards({ name: Constants.testAgileProjectKey }); |
| 15 | + test.sequential.skip('should create new sprint', async ({ expect }) => { |
| 16 | + const boards = await client.board.getAllBoards({ name: Constants.testAgileProjectKey }); |
26 | 17 |
|
27 | | - expect(boards.total).toBe(1); |
| 18 | + expect(boards.total).toBe(1); |
28 | 19 |
|
29 | | - [board] = boards.values; |
| 20 | + [board] = boards.values; |
30 | 21 |
|
31 | | - // @ts-expect-error Wrong typings |
32 | | - sprint = await client.sprint.createSprint({ |
33 | | - name: 'New sprint', |
34 | 22 | // @ts-expect-error Wrong typings |
35 | | - originBoardId: board.id, |
| 23 | + sprint = await client.sprint.createSprint({ |
| 24 | + name: 'New sprint', |
| 25 | + // @ts-expect-error Wrong typings |
| 26 | + originBoardId: board.id, |
| 27 | + }); |
| 28 | + |
| 29 | + expect(!!sprint).toBeTruthy(); |
| 30 | + expect(sprint.name).toBe('New sprint'); |
| 31 | + expect(sprint.state).toBe('future'); |
36 | 32 | }); |
37 | 33 |
|
38 | | - expect(!!sprint).toBeTruthy(); |
39 | | - expect(sprint.name).toBe('New sprint'); |
40 | | - expect(sprint.state).toBe('future'); |
41 | | -}); |
42 | | - |
43 | | -test.sequential.skip('should create and move task to sprint', async ({ expect }) => { |
44 | | - const issue = await getVersion3Client().issues.createIssue({ |
45 | | - fields: { |
46 | | - summary: 'Test task', |
47 | | - project: { |
48 | | - key: Constants.testAgileProjectKey, |
| 34 | + test.sequential.skip('should create and move task to sprint', async ({ expect }) => { |
| 35 | + const issue = await getVersion3Client().issues.createIssue({ |
| 36 | + fields: { |
| 37 | + summary: 'Test task', |
| 38 | + project: { |
| 39 | + key: Constants.testAgileProjectKey, |
| 40 | + }, |
| 41 | + issuetype: { |
| 42 | + name: 'Task', |
| 43 | + }, |
49 | 44 | }, |
50 | | - issuetype: { |
51 | | - name: 'Task', |
52 | | - }, |
53 | | - }, |
54 | | - }); |
| 45 | + }); |
55 | 46 |
|
56 | | - await client.backlog.moveIssuesToBacklog({ |
57 | | - issues: [issue.key], |
58 | | - }); |
| 47 | + await client.backlog.moveIssuesToBacklog({ |
| 48 | + issues: [issue.key], |
| 49 | + }); |
| 50 | + |
| 51 | + await client.sprint.moveIssuesToSprintAndRank({ |
| 52 | + sprintId: sprint.id, |
| 53 | + issues: [issue.key], |
| 54 | + }); |
59 | 55 |
|
60 | | - await client.sprint.moveIssuesToSprintAndRank({ |
61 | | - sprintId: sprint.id, |
62 | | - issues: [issue.key], |
| 56 | + expect(!!issue).toBeTruthy(); |
63 | 57 | }); |
64 | 58 |
|
65 | | - expect(!!issue).toBeTruthy(); |
66 | | -}); |
| 59 | + test.sequential.skip('should return issues for sprint', async ({ expect }) => { |
| 60 | + const { issues } = await client.sprint.getIssuesForSprint({ |
| 61 | + sprintId: sprint.id, |
| 62 | + }); |
67 | 63 |
|
68 | | -test.sequential.skip('should return issues for sprint', async ({ expect }) => { |
69 | | - const { issues } = await client.sprint.getIssuesForSprint({ |
70 | | - sprintId: sprint.id, |
| 64 | + expect(!!issues).toBeTruthy(); |
| 65 | + expect(issues[0].fields?.summary).toBe('Test task'); |
71 | 66 | }); |
72 | 67 |
|
73 | | - expect(!!issues).toBeTruthy(); |
74 | | - expect(issues[0].fields?.summary).toBe('Test task'); |
75 | | -}); |
| 68 | + test.sequential.skip('should partially update sprint', async ({ expect }) => { |
| 69 | + const newSprint = await client.sprint.partiallyUpdateSprint({ |
| 70 | + sprintId: sprint.id, |
| 71 | + state: 'active', |
| 72 | + startDate: new Date(), |
| 73 | + endDate: new Date(Date.now() + 1000), |
| 74 | + }); |
76 | 75 |
|
77 | | -test.sequential.skip('should partially update sprint', async ({ expect }) => { |
78 | | - const newSprint = await client.sprint.partiallyUpdateSprint({ |
79 | | - sprintId: sprint.id, |
80 | | - state: 'active', |
81 | | - startDate: new Date(), |
82 | | - endDate: new Date(Date.now() + 1000), |
| 76 | + expect(newSprint.state).toBe('active'); |
83 | 77 | }); |
84 | 78 |
|
85 | | - expect(newSprint.state).toBe('active'); |
86 | | -}); |
87 | | - |
88 | | -test.sequential.skip('should remove sprint', async () => { |
89 | | - await client.sprint.deleteSprint({ sprintId: sprint.id }); |
| 79 | + test.sequential.skip('should remove sprint', async () => { |
| 80 | + await client.sprint.deleteSprint({ sprintId: sprint.id }); |
| 81 | + }); |
90 | 82 | }); |
0 commit comments