Skip to content

Commit 12db6ce

Browse files
committed
🏷️ Convert examples and tests to ESM
1 parent 44e4c94 commit 12db6ce

Some content is hidden

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

69 files changed

+120
-120
lines changed

examples/src/addFixVersion.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Version3Client } from 'jira.js';
2-
import { createIssue } from './utils';
3-
import { apiToken, email, host } from './credentials';
2+
import { createIssue } from './utils/index.js';
3+
import { apiToken, email, host } from './credentials.js';
44

55
async function addFixVersion() {
66
const client = new Version3Client({

examples/src/addWorklog.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Version3Client } from 'jira.js';
2-
import { createIssue } from './utils';
3-
import { apiToken, email, host } from './credentials';
2+
import { createIssue } from './utils/index.js';
3+
import { apiToken, email, host } from './credentials.js';
44

55
async function addWorklog() {
66
const client = new Version3Client({

examples/src/basic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Version3Client } from 'jira.js';
2-
import { apiToken, email, host } from './credentials';
2+
import { apiToken, email, host } from './credentials.js';
33

44
const client = new Version3Client({
55
host,

examples/src/getAllWorklogs.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Version3Client } from 'jira.js';
22
import type { Worklog } from 'jira.js/out/version3/models';
3-
import { apiToken, email, host } from './credentials';
4-
import { addWorklog, createIssue } from './utils';
3+
import { apiToken, email, host } from './credentials.js';
4+
import { addWorklog, createIssue } from './utils/index.js';
55

66
async function getAllWorklogs() {
77
const client = new Version3Client({

examples/src/utils/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './addWorklog';
2-
export * from './createIssue';
1+
export * from './addWorklog.js';
2+
export * from './createIssue.js';

tests/integration/agile/sprint.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import test from 'ava';
2-
import { AgileModels } from '../../../src';
3-
import { Constants } from '../constants';
2+
import { AgileModels } from '../../../src/index.js';
3+
import { Constants } from '../constants.js';
44
import {
55
createAgileProject, deleteAgileProject, getAgileClient, getVersion3Client,
6-
} from '../utils';
6+
} from '../utils/index.js';
77

88
const client = getAgileClient();
99

tests/integration/index.ts

+2-2
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 './constants.js';
2+
export * as Utils from './utils/index.js';

tests/integration/utils/cleanupEnvironment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deleteSoftwareProject } from './deleteSoftwareProject';
1+
import { deleteSoftwareProject } from './deleteSoftwareProject.js';
22

33
export const cleanupEnvironment = async () => {
44
await deleteSoftwareProject();

tests/integration/utils/createAgileProject.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Constants } from '../constants';
2-
import { getVersion3Client } from './getClient';
1+
import { Constants } from '../constants.js';
2+
import { getVersion3Client } from './getClient.js';
33

44
export const createAgileProject = async () => {
55
const client = getVersion3Client();

tests/integration/utils/createIssue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Constants } from '../constants';
2-
import { getVersion2Client } from './getClient';
1+
import { Constants } from '../constants.js';
2+
import { getVersion2Client } from './getClient.js';
33

44
export const createIssue = async () => {
55
const client = getVersion2Client();

tests/integration/utils/createSoftwareProject.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AxiosError } from 'axios';
2-
import { Constants } from '../constants';
3-
import { getVersion2Client } from './getClient';
2+
import { Constants } from '../constants.js';
3+
import { getVersion2Client } from './getClient.js';
44

55
export const createSoftwareProject = async () => {
66
const client = getVersion2Client();

tests/integration/utils/deleteAgileProject.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Constants } from '../constants';
2-
import { getVersion3Client } from './getClient';
1+
import { Constants } from '../constants.js';
2+
import { getVersion3Client } from './getClient.js';
33

44
export const deleteAgileProject = async () => {
55
const client = getVersion3Client();

tests/integration/utils/deleteSoftwareProject.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AxiosError } from 'axios';
2-
import { Constants } from '../constants';
3-
import { getVersion2Client } from './getClient';
2+
import { Constants } from '../constants.js';
3+
import { getVersion2Client } from './getClient.js';
44

55
export const deleteSoftwareProject = async () => {
66
const client = getVersion2Client();

tests/integration/utils/getClient.ts

+1-1
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 '../../../src/index.js';
22

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

tests/integration/utils/index.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export * from './cleanupEnvironment';
2-
export * from './createAgileProject';
3-
export * from './createIssue';
4-
export * from './createSoftwareProject';
5-
export * from './deleteAgileProject';
6-
export * from './deleteSoftwareProject';
7-
export * from './getClient';
8-
export * from './prepareEnvironment';
1+
export * from './cleanupEnvironment.js';
2+
export * from './createAgileProject.js';
3+
export * from './createIssue.js';
4+
export * from './createSoftwareProject.js';
5+
export * from './deleteAgileProject.js';
6+
export * from './deleteSoftwareProject.js';
7+
export * from './getClient.js';
8+
export * from './prepareEnvironment.js';

tests/integration/utils/prepareEnvironment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSoftwareProject } from './createSoftwareProject';
1+
import { createSoftwareProject } from './createSoftwareProject.js';
22

33
export const prepareEnvironment = async () => {
44
await createSoftwareProject();

tests/integration/version2/avatars.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Avatar } from '../../../src/version3/models';
3-
import { getVersion2Client } from '../utils';
2+
import type { Avatar } from '../../../src/version3/models/index.js';
3+
import { getVersion2Client } from '../utils/index.js';
44

55
const client = getVersion2Client();
66

tests/integration/version2/dashboards.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { getVersion2Client } from '../utils';
4-
import { Version2Models } from '../../../src';
2+
import { Constants } from '../constants.js';
3+
import { getVersion2Client } from '../utils/index.js';
4+
import { Version2Models } from '../../../src/index.js';
55

66
let dashboard: Version2Models.Dashboard;
77
const client = getVersion2Client();

tests/integration/version2/groups.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '..';
3-
import { getVersion2Client } from '../utils';
2+
import { Constants } from '../index.js';
3+
import { getVersion2Client } from '../utils/index.js';
44

55
const client = getVersion2Client();
66

tests/integration/version2/issueAttachments.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as fs from 'fs';
22
import test from 'ava';
3-
import { Constants } from '../constants';
4-
import { Attachment, Issue } from '../../../src/version2/models';
5-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
3+
import { Constants } from '../constants.js';
4+
import type { Attachment,Issue } from '../../../src/version2/models/index.js';
5+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
66

77
const client = getVersion2Client({ noCheckAtlassianToken: true });
88

tests/integration/version2/issueComments.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AxiosError } from 'axios';
22
import test from 'ava';
3-
import { Constants } from '../constants';
4-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
3+
import { Constants } from '../constants.js';
4+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
55

66
test.before(async () => {
77
await prepareEnvironment();

tests/integration/version2/issueSearch.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
2+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
33

44
test.before(async () => {
55
await prepareEnvironment();

tests/integration/version2/issueVotes.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import test from 'ava';
2-
import { CreatedIssue } from '../../../src/version2/models';
2+
import type { CreatedIssue } from '../../../src/version2/models/index.js';
33
import {
44
cleanupEnvironment, createIssue, getVersion2Client, prepareEnvironment,
5-
} from '../utils';
5+
} from '../utils/index.js';
66

77
const client = getVersion2Client();
88
let createdIssue: CreatedIssue;

tests/integration/version2/issues.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { Version2Models } from '../../../src';
4-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { Version2Models } from '../../../src/index.js';
4+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
55

66
let createdIssue: Version2Models.CreatedIssue;
77
const client = getVersion2Client();

tests/integration/version2/projectRoles.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
44

55
const client = getVersion2Client();
66

tests/integration/version2/projects.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { cleanupEnvironment, getVersion2Client, prepareEnvironment } from '../utils/index.js';
44

55
test.before(async () => {
66
await prepareEnvironment();

tests/integration/version3/avatars.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Avatar } from '../../../src/version3/models';
3-
import { getVersion3Client } from '../utils';
2+
import type { Avatar } from '../../../src/version3/models/index.js';
3+
import { getVersion3Client } from '../utils/index.js';
44

55
const client = getVersion3Client();
66

tests/integration/version3/dashboards.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { getVersion3Client } from '../utils';
4-
import { Version3Models } from '../../../src';
2+
import { Constants } from '../constants.js';
3+
import { getVersion3Client } from '../utils/index.js';
4+
import { Version3Models } from '../../../src/index.js';
55

66
let dashboard: Version3Models.Dashboard;
77
const client = getVersion3Client();

tests/integration/version3/groups.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '..';
3-
import { getVersion3Client } from '../utils';
2+
import { Constants } from '../index.js';
3+
import { getVersion3Client } from '../utils/index.js';
44

55
const client = getVersion3Client();
66

tests/integration/version3/issueAttachments.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as fs from 'fs';
22
import test from 'ava';
3-
import { Constants } from '../constants';
4-
import { Attachment, Issue } from '../../../src/version3/models';
5-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
3+
import { Constants } from '../constants.js';
4+
import type { Attachment,Issue } from '../../../src/version3/models/index.js';
5+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
66

77
const client = getVersion3Client({ noCheckAtlassianToken: true });
88

tests/integration/version3/issueComments.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
44

55
test.before(async () => {
66
await prepareEnvironment();

tests/integration/version3/issueSearch.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
2+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
33

44
test.before(async () => {
55
await prepareEnvironment();

tests/integration/version3/issueVotes.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import test from 'ava';
2-
import { CreatedIssue } from '../../../src/version3/models';
2+
import type { CreatedIssue } from '../../../src/version3/models/index.js';
33
import {
44
cleanupEnvironment, createIssue, getVersion3Client, prepareEnvironment,
5-
} from '../utils';
5+
} from '../utils/index.js';
66

77
const client = getVersion3Client();
88
let createdIssue: CreatedIssue;

tests/integration/version3/issues.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { Version3Models } from '../../../src';
4-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { Version3Models } from '../../../src/index.js';
4+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
55

66
let createdIssue: Version3Models.CreatedIssue;
77
const client = getVersion3Client();

tests/integration/version3/projectRoles.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
44

55
const client = getVersion3Client();
66

tests/integration/version3/projects.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Constants } from '../constants';
3-
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils';
2+
import { Constants } from '../constants.js';
3+
import { cleanupEnvironment, getVersion3Client, prepareEnvironment } from '../utils/index.js';
44

55
test.before(async () => {
66
await prepareEnvironment();

tests/unit/agile/board.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as sinon from 'sinon';
22
import test from 'ava';
3-
import { AgileClient } from '../../../src';
3+
import { AgileClient } from '../../../src/index.js';
44

55
const config = { host: 'http://localhost' };
66

tests/unit/agile/issue.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as sinon from 'sinon';
22
import test from 'ava';
3-
import { AgileClient } from '../../../src';
3+
import { AgileClient } from '../../../src/index.js';
44

55
test('getIssue should accept follow parameters', t => {
66
const client = new AgileClient({ host: 'http://localhost' });

tests/unit/agile/sprint.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as sinon from 'sinon';
22
import test from 'ava';
3-
import { AgileClient } from '../../../src';
3+
import { AgileClient } from '../../../src/index.js';
44

55
test('moveIssuesToSprintAndRank should accept follow parameters', t => {
66
const client = new AgileClient({ host: 'http://localhost' });

tests/unit/clients/baseClient.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as sinon from 'sinon';
22
import test from 'ava';
3-
import { BaseClient } from '../../../src';
3+
import { BaseClient } from '../../../src/index.js';
44

55
const XAtlassianToken = 'X-Atlassian-Token';
66

tests/unit/createClient.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
22
import {
33
AgileClient, BaseClient, ClientType, createClient, Version2Client, Version3Client,
4-
} from '../../src';
4+
} from '../../src/index.js';
55

66
const defaultConfig = { host: 'http://localhost' };
77

tests/unit/index.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import {
33
AgileClient,
44
AgileModels,
55
AgileParameters,
6-
Callback,
7-
Config,
86
ServiceDeskClient,
97
ServiceDeskModels,
108
ServiceDeskParameters,
@@ -14,7 +12,9 @@ import {
1412
Version3Client,
1513
Version3Models,
1614
Version3Parameters,
17-
} from '../../src';
15+
type Callback,
16+
type Config,
17+
} from '../../src/index.js';
1818

1919
test('Callback should be defined', t => {
2020
const callback: Callback<string> = () => {};

tests/unit/services/authenticationService.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
2-
import { Config } from '../../../src';
3-
import { getAuthenticationToken } from '../../../src/services/authenticationService';
2+
import type { Config } from '../../../src/index.js';
3+
import { getAuthenticationToken } from '../../../src/services/authenticationService/index.js';
44

55
test('should return undefined when authentication does not used', async t => {
66
const authentication = undefined;

0 commit comments

Comments
 (0)