Skip to content

Commit

Permalink
feat: add thai language (#3)
Browse files Browse the repository at this point in the history
* feat: add thai language

* chore: add some tests

* feat: improve romanization for Thai language

* chore: change test a little

---------

Co-authored-by: Bas950 <[email protected]>
  • Loading branch information
Slowlife01 and Bas950 authored Sep 2, 2024
1 parent 10e3a4f commit a166ffd
Show file tree
Hide file tree
Showing 4 changed files with 5,231 additions and 5 deletions.
21 changes: 17 additions & 4 deletions packages/romanize-thai/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { describe, it } from 'vitest'
import { THAI_REGEX, 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', ({ expect }) => {
for (const [input, output] of successTests) {
const result = romanize(input)
expect(result).not.toMatch(THAI_REGEX)
expect(result).toBe(output)
}
})

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('안녕하세요')
})
})
Loading

0 comments on commit a166ffd

Please sign in to comment.