Skip to content

Commit

Permalink
[TLAC-429] test: Convert tests to TS, remove disused tests (#104)
Browse files Browse the repository at this point in the history
* test: Convert tests to TS, remove disused tests

The Jest configurtion was only running tests with a .ts or .tsx extension
as a result all .spec.js files were not being run. Some were found to be redundant
and have been removed, the remaining have been converted to TypeScript.

* fix bad merge, remove ddeleted file
  • Loading branch information
RoryH authored Mar 13, 2023
1 parent b4e8c7c commit 3c9baed
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 408 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"devDependencies": {
"@types/browserify": "^12.0.36",
"@types/debug": "^4.1.5",
"@types/faker": "^4.1.12",
"@types/invariant": "^2.2.33",
"@types/jest": "^24.9.1",
"@types/lodash": "^4.14.160",
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/language/ImportDeclaration.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export interface IImportDeclarationConfig {
defaultExport?: string;
namedExports: string[];
namedExports?: string[];
moduleName: string;
}

export default class ImportDeclaration {
public defaultExport?: string;
public namedExports: string[];
public namedExports?: string[];
public moduleName: string;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
const getEndpointUriStr = require('../../../../../src/generators/js_isomorphic/codegen/util/service.js').getEndpointUriStr;
import { getEndpointUriStr } from '../../../../../src/generators/js_isomorphic/codegen/util/service';

describe ('getEndpointUriStr', () => {
describe('getEndpointUriStr', () => {
test('should get expected basic endpoint', () => {
const result = getEndpointUriStr({
path: '/this/is/the/path'
path: '/this/is/the/path',
});
expect(result).toEqual('/this/is/the/path');
});

test('should substitute path parameters correctly', () => {
const result = getEndpointUriStr({
path: '/this/is/:variable1/the/:path'
path: '/this/is/:variable1/the/:path',
});
expect(result).toEqual('/this/is/${variable1}/the/${path}');
});

test('should convert path parameters to camelCase', () => {
const result = getEndpointUriStr({
path: '/:dannyDeVito/is/:pretty_small'
path: '/:dannyDeVito/is/:pretty_small',
});
expect(result).toEqual('/${dannyDeVito}/is/${prettySmall}');
});

test('should maintain url suffix if last url part has parameter', () => {
const result = getEndpointUriStr({
path: '/:dannyDeVito/is/:pretty_small.csv'
path: '/:dannyDeVito/is/:pretty_small.csv',
});
expect(result).toEqual('/${dannyDeVito}/is/${prettySmall}.csv');
});

test('should maintain url suffix with extra periods', () => {
const result = getEndpointUriStr({
path: '/:dannyDeVito/is/:pretty_small.tar.gz'
path: '/:dannyDeVito/is/:pretty_small.tar.gz',
});
expect(result).toEqual('/${dannyDeVito}/is/${prettySmall}.tar.gz');
});
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

79 changes: 0 additions & 79 deletions test/specs/generators/prop_types/utilities/isCyclic.spec.js

This file was deleted.

31 changes: 0 additions & 31 deletions test/specs/generators/prop_types/utilities/toDefaultExport.spec.js

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions test/specs/generators/prop_types/utilities/toModuleName.spec.js

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3c9baed

Please sign in to comment.