Skip to content

Commit ad74bc8

Browse files
committed
Test platform swithed from
1 parent 0d76aad commit ad74bc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2231
-3111
lines changed

package-lock.json

Lines changed: 1556 additions & 2454 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"lint:fix": "npm run lint:tests -- --fix && npm run lint:examples -- --fix && npm run lint:src:agile -- --fix && npm run lint:src:clients -- --fix && npm run lint:src:services -- --fix && npm run lint:src:version2 -- --fix && npm run lint:src:version3 -- --fix && npm run lint:src:serviceDesk -- --fix && npm run lint:src:files -- --fix",
3636
"doc": "typedoc --name \"Jira.js - Jira Cloud API library\" --out docs ./src/index.ts --plugin typedoc-plugin-extras --footerDate --footerTime --footerTypedocVersion --favicon https://svgshare.com/i/bHF.svg",
3737
"test": "npm run test:unit && npm run test:integration",
38-
"test:unit": "ava tests/unit --timeout=2m -с 8",
39-
"test:integration": "ava --timeout=2m --fail-fast --no-worker-threads -c 1 -s tests/integration/**/*.test.ts",
38+
"test:unit": "vitest run tests/unit --maxWorkers=8 --sequence.concurrent",
39+
"test:integration": "avitest --bail=1 --no-file-parallelism --max-concurrency 1 tests/integration",
4040
"replace:all": "npm run replace:permissions:version2 && npm run replace:permissions:version3 && npm run replace:pagination:version2 && npm run replace:pagination:version3 && npm run replace:async:version2 && npm run replace:async:version3 && npm run replace:expansion:version2 && npm run replace:expansion:version3 && npm run replace:ordering:version2 && npm run replace:ordering:version3 && npm run replace:groupMember:version2 && npm run replace:workflowPaginated:version2",
4141
"replace:permissions:version2": "grep -rl \"(#permissions)\" ./src/version2 | xargs sed -i '' 's/(#permissions)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/intro\\/#permissions)/g'",
4242
"replace:permissions:version3": "grep -rl \"(#permissions)\" ./src/version3 | xargs sed -i '' 's/(#permissions)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v3\\/intro\\/#permissions)/g'",
@@ -52,41 +52,27 @@
5252
"replace:workflowPaginated:version2": "grep -rl \"(#api-rest-api-2-workflow-search-get)\" ./src/version2 | xargs sed -i '' 's/(#api-rest-api-2-workflow-search-get)/(https:\\/\\/developer.atlassian.com\\/cloud\\/jira\\/platform\\/rest\\/v2\\/api-group-workflows\\/#api-rest-api-2-workflow-search-get)/g'",
5353
"code:formatting": "npm run replace:all && npm run prettier && npm run lint:fix"
5454
},
55-
"ava": {
56-
"extensions": [
57-
"ts"
58-
],
59-
"require": [
60-
"@swc-node/register",
61-
"dotenv/config"
62-
],
63-
"environmentVariables": {
64-
"SWC_NODE_PROJECT": "./tsconfig.lint.json"
65-
}
66-
},
6755
"devDependencies": {
68-
"@swc-node/register": "^1.9.2",
69-
"@swc/helpers": "^0.5.11",
70-
"@types/node": "^18.19.38",
56+
"@types/node": "^18.19.44",
7157
"@types/sinon": "^17.0.3",
72-
"@typescript-eslint/eslint-plugin": "^7.13.1",
73-
"@typescript-eslint/parser": "^7.13.1",
74-
"ava": "^6.1.3",
58+
"@typescript-eslint/eslint-plugin": "^8.1.0",
59+
"@typescript-eslint/parser": "^8.1.0",
7560
"dotenv": "^16.4.5",
7661
"eslint": "^8.57.0",
7762
"eslint-config-airbnb-base": "^15.0.0",
7863
"eslint-import-resolver-typescript": "^3.6.1",
7964
"eslint-plugin-import": "^2.29.1",
80-
"prettier": "^3.3.2",
65+
"prettier": "^3.3.3",
8166
"prettier-plugin-jsdoc": "^1.3.0",
8267
"sinon": "^18.0.0",
83-
"ts-node": "^10.9.2",
84-
"typedoc": "^0.25.13",
85-
"typedoc-plugin-extras": "^3.0.0",
86-
"typescript": "^5.4.5"
68+
"typedoc": "^0.26.5",
69+
"typedoc-plugin-extras": "^3.1.0",
70+
"typescript": "^5.5.4",
71+
"vite-tsconfig-paths": "^4.3.2",
72+
"vitest": "^2.0.5"
8773
},
8874
"dependencies": {
89-
"axios": "^1.7.2",
75+
"axios": "^1.7.4",
9076
"form-data": "^4.0.0",
9177
"tslib": "^2.6.3"
9278
}
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
import test from 'ava';
2-
import { AgileModels } from '../../../src';
3-
import { Constants } from '../constants';
1+
import { afterAll, beforeAll, test } from 'vitest';
2+
import { AgileModels } from '@jirajs';
3+
import { Constants } from '@tests/constants';
44
import {
5-
createAgileProject, deleteAgileProject, getAgileClient, getVersion3Client,
6-
} from '../utils';
5+
createAgileProject,
6+
deleteAgileProject,
7+
getAgileClient,
8+
getVersion3Client,
9+
} from '@tests/utils';
710

811
const client = getAgileClient();
912

1013
let board: any;
1114
let sprint: AgileModels.Sprint;
1215

13-
test.before(async () => {
16+
beforeAll(async () => {
1417
await createAgileProject();
1518
});
1619

17-
test.after(async () => {
20+
afterAll(async () => {
1821
await deleteAgileProject();
1922
});
2023

21-
test.serial('should create new sprint', async t => {
24+
test.sequential('should create new sprint', async ({ expect }) => {
2225
const boards = await client.board.getAllBoards({ name: Constants.testAgileProjectKey });
2326

24-
t.is(boards.total, 1);
27+
expect(boards.total).toBe(1);
2528

2629
[board] = boards.values;
2730

@@ -30,12 +33,12 @@ test.serial('should create new sprint', async t => {
3033
originBoardId: board.id,
3134
});
3235

33-
t.truthy(!!sprint);
34-
t.is(sprint.name, 'New sprint');
35-
t.is(sprint.state, 'future');
36+
expect(!!sprint).toBeTruthy();
37+
expect(sprint.name).toBe('New sprint');
38+
expect(sprint.state).toBe('future');
3639
});
3740

38-
test.serial('should create and move task to sprint', async t => {
41+
test.sequential('should create and move task to sprint', async ({ expect }) => {
3942
const issue = await getVersion3Client().issues.createIssue({
4043
fields: {
4144
summary: 'Test task',
@@ -57,33 +60,29 @@ test.serial('should create and move task to sprint', async t => {
5760
issues: [issue.key],
5861
});
5962

60-
t.truthy(!!issue);
63+
expect(!!issue).toBeTruthy();
6164
});
6265

63-
test.serial('should return issues for sprint', async t => {
66+
test.sequential('should return issues for sprint', async ({ expect }) => {
6467
const { issues } = await client.sprint.getIssuesForSprint({
6568
sprintId: sprint.id,
6669
});
6770

68-
t.truthy(!!issues);
69-
t.is(issues[0].fields?.summary, 'Test task');
71+
expect(!!issues).toBeTruthy();
72+
expect(issues[0].fields?.summary).toBe('Test task');
7073
});
7174

72-
test.serial('should partially update sprint', async t => {
75+
test.sequential('should partially update sprint', async ({ expect }) => {
7376
const newSprint = await client.sprint.partiallyUpdateSprint({
7477
sprintId: sprint.id,
7578
state: 'active',
7679
startDate: new Date(),
7780
endDate: new Date(Date.now() + 1000),
7881
});
7982

80-
t.is(newSprint.state, 'active');
83+
expect(newSprint.state).toBe('active');
8184
});
8285

83-
test.serial('should remove sprint', async t => {
84-
await client.sprint.deleteSprint({
85-
sprintId: sprint.id,
86-
});
87-
88-
t.pass();
86+
test.sequential('should remove sprint', async ({ expect }) => {
87+
await client.sprint.deleteSprint({ sprintId: sprint.id });
8988
});

tests/integration/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './constants';
2-
export * as Utils from './utils';
1+
export * from '@tests/constants';
2+
export * as Utils from '@tests/utils';

tests/integration/utils/createAgileProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Constants } from '../constants';
1+
import { Constants } from '@tests/constants';
22
import { getVersion3Client } from './getClient';
33

44
export const createAgileProject = async () => {

tests/integration/utils/createIssue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Constants } from '../constants';
1+
import { Constants } from '@tests/constants';
22
import { getVersion2Client } from './getClient';
33

44
export const createIssue = async () => {

tests/integration/utils/createSoftwareProject.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import { AxiosError } from 'axios';
2-
import { Constants } from '../constants';
2+
import { Constants } from '@tests/constants';
33
import { getVersion2Client } from './getClient';
44

55
export const createSoftwareProject = async () => {
66
const client = getVersion2Client();
7+
const currentUser = await client.myself.getCurrentUser();
8+
9+
if (!currentUser.accountId) throw new Error("Couldn't get the current user's account ID", { cause: { currentUser } });
710

811
return client.projects
912
.createProject({
1013
key: Constants.testProjectKey,
1114
name: Constants.testProjectName,
12-
leadAccountId: '5b6d7f20e6dba529eefdbad9',
15+
leadAccountId: currentUser.accountId,
1316
projectTypeKey: 'software',
1417
})
1518
.catch((error: AxiosError) => {

tests/integration/utils/deleteAgileProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Constants } from '../constants';
1+
import { Constants } from '@tests/constants';
22
import { getVersion3Client } from './getClient';
33

44
export const deleteAgileProject = async () => {

tests/integration/utils/deleteSoftwareProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AxiosError } from 'axios';
2-
import { Constants } from '../constants';
2+
import { Constants } from '@tests/constants';
33
import { getVersion2Client } from './getClient';
44

55
export const deleteSoftwareProject = async () => {

tests/integration/utils/getClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClientType, Config, createClient } from '../../../src';
1+
import { ClientType, type Config, createClient } from '@jirajs';
22

33
const config = {
44
host: process.env.HOST!,

0 commit comments

Comments
 (0)