Skip to content

Commit

Permalink
✅ test: Fixed broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
motss committed Jan 16, 2019
1 parent cf52717 commit 0792e08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function normalizeSync(input: string) {
return !input.length ? input : input.replace(/(\S)/g, (_, p) => replaceDiacritics(p));
}

export async function normalize(input: string) {
export async function normalize(input?: string) {
return normalizeSync(input);
}

Expand Down
21 changes: 11 additions & 10 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ async function throwsWhenInvalidInput() {
try {
await normalize(null);
} catch (e) {
const err = new TypeError(`Expected 'input' to be of type string, but received '${null}'`);
const err = new TypeError(`Expected 'input' to be of type string, but received 'null'`);
assertEqual(e, err);
}
}

async function throwsWhenInputIsUndefined() {
try {
await normalize();
} catch (e) {
const err = new TypeError(`Expected 'input' to be of type string, but received 'undefined'`);
assertEqual(e, err);
}
}
Expand All @@ -33,14 +42,6 @@ async function normalizesStrings() {
}
}

async function normalizesStringsWithoutInput() {
try {
assertEqual(await normalize(), '');
} catch (e) {
throw e;
}
}

async function normalizesStringsWithoutUsingNativeFunction() {
const cachedFn = String.prototype.normalize;
String.prototype.normalize = null;
Expand Down Expand Up @@ -76,7 +77,7 @@ async function normalizeSingleCharacter() {

Promise.all([
throwsWhenInvalidInput,
normalizesStringsWithoutInput,
throwsWhenInputIsUndefined,
normalizesStringsWithoutUsingNativeFunction,
returnsOriginalCharacterWhenNoMatchFound,
normalizeSingleCharacter,
Expand Down

0 comments on commit 0792e08

Please sign in to comment.