-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ansumsingh-unittests: Add contribution graph section Update all dependencies except webpack things Update changelog Update the Readme with development instructions Update romanized tests to use expect style assertions Add test for layouts modules Extract keys out to helper files and use js style code for assertion Convert tests to use ESM style imports Rename and relocate tests similar to src folder structure Require tests directly from relative links Some formating Added new line at the end of the file update documentation for building and testing the package. Added undefined case as well Added test for validating expected output. added files for test Installed mocha test framework
- Loading branch information
Showing
9 changed files
with
2,207 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
export const testKeys = [ | ||
"+", | ||
".", | ||
"/", | ||
"0", | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5", | ||
"6", | ||
"7", | ||
"8", | ||
"9", | ||
"<", | ||
"=", | ||
">", | ||
"?", | ||
"A", | ||
"B", | ||
"C", | ||
"D", | ||
"E", | ||
"F", | ||
"G", | ||
"H", | ||
"I", | ||
"J", | ||
"K", | ||
"L", | ||
"M", | ||
"N", | ||
"O", | ||
"P", | ||
"Q", | ||
"R", | ||
"S", | ||
"T", | ||
"U", | ||
"V", | ||
"W", | ||
"X", | ||
"Y", | ||
"Z", | ||
"[", | ||
"\\", | ||
"]", | ||
"^", | ||
"_", | ||
"`", | ||
"a", | ||
"b", | ||
"c", | ||
"d", | ||
"e", | ||
"f", | ||
"g", | ||
"h", | ||
"i", | ||
"j", | ||
"k", | ||
"l", | ||
"m", | ||
"n", | ||
"o", | ||
"p", | ||
"q", | ||
"r", | ||
"s", | ||
"t", | ||
"u", | ||
"v", | ||
"w", | ||
"x", | ||
"y", | ||
"z", | ||
"{", | ||
"|", | ||
"}", | ||
"~", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { expect } from "chai"; | ||
import layouts from "../src/layouts"; | ||
|
||
describe("layouts", () => { | ||
it("should return an object of available layouts", () => { | ||
expect(layouts).to.be.an('object'); | ||
expect(layouts).to.have.property('romanized'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
export const expectedKeys = [ | ||
"\u200C", | ||
"।", | ||
"्", | ||
"०", | ||
"१", | ||
"२", | ||
"३", | ||
"४", | ||
"५", | ||
"६", | ||
"७", | ||
"८", | ||
"९", | ||
"ङ", | ||
"\u200D", | ||
"॥", | ||
"?", | ||
"आ", | ||
"भ", | ||
"च", | ||
"ध", | ||
"ै", | ||
"ऊ", | ||
"घ", | ||
"अ", | ||
"ी", | ||
"झ", | ||
"ख", | ||
"ळ", | ||
"ं", | ||
"ण", | ||
"ओ", | ||
"फ", | ||
"ठ", | ||
"ृ", | ||
"श", | ||
"थ", | ||
"ू", | ||
"ँ", | ||
"औ", | ||
"ढ", | ||
"ञ", | ||
"ऋ", | ||
"इ", | ||
"ॐ", | ||
"ए", | ||
"^", | ||
"॒", | ||
"ऽ", | ||
"ा", | ||
"ब", | ||
"छ", | ||
"द", | ||
"े", | ||
"उ", | ||
"ग", | ||
"ह", | ||
"ि", | ||
"ज", | ||
"क", | ||
"ल", | ||
"म", | ||
"न", | ||
"ो", | ||
"प", | ||
"ट", | ||
"र", | ||
"स", | ||
"त", | ||
"ु", | ||
"व", | ||
"ौ", | ||
"ड", | ||
"य", | ||
"ष", | ||
"ई", | ||
"ः", | ||
"ऐ", | ||
"़", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect } from "chai"; | ||
import romanized from "../../src/layouts/romanized"; | ||
import { testKeys } from "../helper.js"; | ||
import { expectedKeys } from "./romanized.helper.js"; | ||
|
||
describe("romanized", () => { | ||
describe("formatKey()", () => { | ||
it("should return corresponding romanized Nepali character.", () => { | ||
const receivedKeys = testKeys.map((key) => romanized.formatKey(key)); | ||
expect(receivedKeys).to.deep.equal(expectedKeys); | ||
}); | ||
|
||
it("should return undefined if no mapping exists", () => { | ||
const asciiCodes = [...Array(255 + 1).keys()]; | ||
const asciiKeys = asciiCodes.map((key) => String.fromCharCode(key)); | ||
const filteredKeys = asciiKeys.filter((key) => testKeys.indexOf(key) < 0); | ||
|
||
const receivedKeys = filteredKeys.map((key) => romanized.formatKey(key)); | ||
const expectedKeys = [...Array(receivedKeys.length)]; | ||
|
||
expect(receivedKeys).to.deep.equal(expectedKeys); | ||
}); | ||
}); | ||
}); |