-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
3,564 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
import { describe, it } from 'vitest' | ||
import { THAI_REGEX, failingTests, successTests } from './mocks/testData.js' | ||
|
||
import { romanize } from './index.js' | ||
|
||
describe('romanize-thai', () => { | ||
it('should romanize thai text', () => { | ||
// test code here | ||
it('should romanize thai text', async ({ expect }) => { | ||
for (const { input, romanized } of successTests) { | ||
const result = romanize(input) | ||
expect(result).not.toMatch(THAI_REGEX) | ||
expect(result).toBe(romanized) | ||
} | ||
|
||
for (const { input } of failingTests) { | ||
const result = romanize(input) | ||
if (result.match(THAI_REGEX)) { | ||
expect.fail(`Expected ${input} to be romanized but got ${result}`) | ||
} | ||
} | ||
}) | ||
|
||
it('should not romanize non-thai text', () => { | ||
// test code here | ||
it('should not romanize non-thai text', ({ expect }) => { | ||
expect(romanize('hello')).toBe('hello') | ||
expect(romanize('123')).toBe('123') | ||
expect(romanize('!@#$%^&*()')).toBe('!@#$%^&*()') | ||
//* Shouldn't romanize different languages (e.g. Japanese, Chinese, Korean) | ||
expect(romanize('こんにちは')).toBe('こんにちは') | ||
expect(romanize('你好')).toBe('你好') | ||
expect(romanize('안녕하세요')).toBe('안녕하세요') | ||
}) | ||
}) |
Oops, something went wrong.