Skip to content

Commit

Permalink
refactor: test ts instead js
Browse files Browse the repository at this point in the history
  • Loading branch information
adantoscano committed Sep 12, 2023
1 parent 5e733c9 commit f351e68
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
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

0 comments on commit f351e68

Please sign in to comment.