Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Aug 1, 2024
1 parent 9f9fc78 commit dc72e55
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 150 deletions.
148 changes: 4 additions & 144 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@swc/jest": "^0.2.23",
"@types/node": "^20.3.3",
"alterschema": "^1.1.2",
"change-case": "^4.1.2",
"change-case": "^5.4.4",
"cross-env": "^7.0.3",
"openapi-types": "9.3.0",
"typescript-json-schema": "^0.58.1",
Expand Down
7 changes: 3 additions & 4 deletions src/helpers/FormatHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {
camelCase,
pascalCase,
paramCase,
kebabCase,
constantCase,
snakeCase,
pascalCaseTransformMerge
} from 'change-case';

export enum IndentationTypes {
Expand Down Expand Up @@ -106,15 +105,15 @@ export class FormatHelpers {
* @returns {string}
*/
static toPascalCaseMergingNumbers(value: string): string {
return pascalCase(value, { transform: pascalCaseTransformMerge });
return pascalCase(value);
}

/**
* Transform into a lower cased string with dashes between words.
* @param {string} value to transform
* @returns {string}
*/
static toParamCase = paramCase;
static toParamCase = kebabCase;

/**
* Transform into upper case string with an underscore between words.
Expand Down
11 changes: 10 additions & 1 deletion test/helpers/FormatHelpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { FormatHelpers, IndentationTypes } from '../../src/helpers';

import {
camelCase
} from 'change-case';
describe('FormatHelpers', () => {
describe('lowerFirst', () => {
test('should convert first char to lowercase', () => {
Expand Down Expand Up @@ -55,7 +58,13 @@ describe('FormatHelpers', () => {
expect(content).toEqual('\t\t Test');
});
});


describe('toCamelCase', () => {
test('should not change outletGSId', () => {
const content = camelCase('outletGSId');
expect(content).toEqual('outletGSId');
});
});
describe('replaceSpecialCharacters', () => {
test('should replace any special character', () => {
const content = FormatHelpers.replaceSpecialCharacters(' !"#$%');
Expand Down

0 comments on commit dc72e55

Please sign in to comment.