Created
July 10, 2020 06:20
-
-
Save ann-kilzer/03ef15da4601ffc6dcc318c9455d5192 to your computer and use it in GitHub Desktop.
Japanese Validator Unit Test
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
import { expect } from 'chai'; | |
import japanese from '@/validators/japanese'; | |
describe('japanese.js', () => { | |
it('accepts Hiragana', () => { | |
expect(japanese('すごいですね!わたしはねこです。')).to.be.true; | |
}); | |
it('accepts Katakana', () => { | |
expect(japanese('チーズバーガートネコ!')).to.be.true; | |
}); | |
it('accepts Kanji', () => { | |
expect(japanese('鼠色大学')).to.be.true; | |
}); | |
it('rejects Rōmaji', () => { | |
expect(japanese('This is Romaji')).to.be.false; | |
expect(japanese('すごいsurprise')).to.be.false; | |
}); | |
it('rejects Emoji', () => { | |
expect(japanese('🧐')).to.be.false; | |
expect(japanese('すごい🧐')).to.be.false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment