Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: test ts instead js #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:markdown/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['@typescript-eslint', 'prettier', 'import', 'html', 'markdown'],
Expand All @@ -17,11 +18,18 @@ module.exports = {
ecmaVersion: 'latest',
sourceType: 'module',
},
ignorePatterns: ['output', 'outputTest', '**/*d.ts'],
ignorePatterns: ['output', 'outputTest', 'dist'],
rules: {
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
indent: ['error', 'tab', { SwitchCase: 1 }],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
overrides: [
{
files: ['**/*.cjs'],
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/capitalize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { capitalize } from '../../helpers/capitalize.js';
import { capitalize } from '../../helpers/capitalize';

describe('capitalize()', () => {
describe('passing "name"', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/helpers/divideIntoDocumentsByTag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DataObjectWith2Tags } from '../mocks/DataObjectWith2Tags.js';
import { DataObjectWithoutTags } from '../mocks/DataObjectWithoutTags.js';
import { DataObjectWith2Tags } from '../mocks/DataObjectWith2Tags';
import { DataObjectWithoutTags } from '../mocks/DataObjectWithoutTags';

import { divideIntoDocumentsByTag } from '../../helpers/divideIntoDocumentsByTag.js';
import { divideIntoDocumentsByTag } from '../../helpers/divideIntoDocumentsByTag';

describe('divideIntoDocumentsByTag()', () => {
describe('passing sample DataObject with 2 different tags', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/getComponentPath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import { getComponentPath } from '../../helpers/getComponentPath.js';
import { getComponentPath } from '../../helpers/getComponentPath';

describe('getComponentPath()', () => {
describe('when $ref has no schema', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/getComponentsFiles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import axios, { AxiosRequestConfig } from 'axios';
import fs, { PathOrFileDescriptor } from 'node:fs';
import { getComponentsFiles } from '../../helpers/getComponentsFiles.js';
import { getComponentsFiles } from '../../helpers/getComponentsFiles';

describe('getComponentsFiles()', () => {
describe('passing an URL', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/helpers/hasRepeatedOperationIdErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DocumentListWithNoRepeatedOperationIds } from '../mocks/DocumentListWithNoRepeatedOperationIds.js';
import { DocumentListWithRepeatedOperationIds } from '../mocks/DocumentListWithRepeatedOperationIds.js';
import { hasRepeatedOperationIdErrors } from '../../helpers/hasRepeatedOperationIdErrors.js';
import { DocumentListWithNoRepeatedOperationIds } from '../mocks/DocumentListWithNoRepeatedOperationIds';
import { DocumentListWithRepeatedOperationIds } from '../mocks/DocumentListWithRepeatedOperationIds';
import { hasRepeatedOperationIdErrors } from '../../helpers/hasRepeatedOperationIdErrors';

describe('checkRepeatedOperationIdErrors()', () => {
describe('passing sample DataObject without repeated operationIds', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/isUrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { isUrl } from '../../helpers/isUrl.js';
import { isUrl } from '../../helpers/isUrl';

describe('isUrl()', () => {
describe('passing http url', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/log.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { log } from '../../helpers/log.js';
import { log } from '../../helpers/log';

describe('log()', () => {
it('console.log has been called', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/parseTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { parseTypes } from '../../helpers/parseTypes.js';
import { parseTypes } from '../../helpers/parseTypes';

describe('parseTypes()', () => {
describe('references to a component', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/resolveSchemaName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { resolveSchemaName } from '../../helpers/resolveSchemaName.js';
import { resolveSchemaName } from '../../helpers/resolveSchemaName';

describe('resolveSchemaName()', () => {
describe('passing a ref', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/toPascalCase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { toPascalCase } from '../../helpers/toPascalCase.js';
import { toPascalCase } from '../../helpers/toPascalCase';

describe('toPascalCase()', () => {
describe('passing "name of the variable"', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/writeOutputFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import fs from 'node:fs';
import { writeOutputFile } from '../../helpers/writeOutputFile.js';
import { writeOutputFile } from '../../helpers/writeOutputFile';

describe('writeOutputFile()', () => {
describe('when output directory does not exists', () => {
Expand Down
Loading