generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
2 changed files
with
84 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { BOOK_REG, MODAL_REG } from './regs' | ||
|
||
describe('test book name reg matching in different languages', () => { | ||
test('should match book name in English', () => { | ||
const bookName = 'John' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in Italian', () => { | ||
const bookName = 'Giovanni' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in Japanese', () => { | ||
const bookName = 'ヨハネ' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in Spanish', () => { | ||
const bookName = 'Juan' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in Chinese', () => { | ||
const bookName = '约翰福音' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in French', () => { | ||
const bookName = 'Josué' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should not cover just one letter', () => { | ||
const bookName = 'J' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(false) | ||
}) | ||
}) | ||
|
||
describe('test modal reg matching in different languages', () => { | ||
test('should match modal in English', () => { | ||
const modal = 'John 1:1' | ||
const reg = new RegExp(MODAL_REG) | ||
expect(reg.test(modal)).toBe(true) | ||
}) | ||
|
||
test('should match modal in English Withou Space', () => { | ||
const modal = 'John1:1' | ||
const reg = new RegExp(MODAL_REG) | ||
expect(reg.test(modal)).toBe(true) | ||
}) | ||
|
||
test('should match book name in French', () => { | ||
const bookName = 'Josué1:1' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should match book name in Chinese', () => { | ||
const bookName = '约翰福音2:1' | ||
const reg = new RegExp(BOOK_REG) | ||
expect(reg.test(bookName)).toBe(true) | ||
}) | ||
|
||
test('should not match if use letter for number', () => { | ||
const modal = 'John a:1' | ||
const reg = new RegExp(MODAL_REG) | ||
expect(reg.test(modal)).toBe(false) | ||
}) | ||
}) |
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