Skip to content

Commit

Permalink
refactor types
Browse files Browse the repository at this point in the history
  • Loading branch information
Casheeew committed Jan 22, 2024
1 parent b6dc4a0 commit 0805f85
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/deinflector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ function testDeinflections() {
{term: '愛しい', source: '愛しかったら', rule: 'adj-i', reasons: ['-tara']},
{term: '愛しい', source: '愛しかったり', rule: 'adj-i', reasons: ['-tari']},
{term: '愛しい', source: '愛しくて', rule: 'adj-i', reasons: ['-te']},
{term: '愛しい', source: '愛しく', rule: 'adj-i', reasons: ['adv']},
{term: '愛しい', source: '愛しくない', rule: 'adj-i', reasons: ['negative']},
{term: '愛しい', source: '愛しく', rule: 'adj-i', reasons: ['adv']},
{term: '愛しい', source: '愛しくない', rule: 'adj-i', reasons: ['negative']},
{term: '愛しい', source: '愛しさ', rule: 'adj-i', reasons: ['noun']},
{term: '愛しい', source: '愛しかった', rule: 'adj-i', reasons: ['past']},
{term: '愛しい', source: '愛しくありません', rule: 'adj-i', reasons: ['polite negative']},
{term: '愛しい', source: '愛しくありません', rule: 'adj-i', reasons: ['polite negative']},
{term: '愛しい', source: '愛しくありませんでした', rule: 'adj-i', reasons: ['polite past negative']},
{term: '愛しい', source: '愛しき', rule: 'adj-i', reasons: ['-ki']},
{term: '愛しい', source: '愛しげ', rule: 'adj-i', reasons: ['-ge']}
Expand Down Expand Up @@ -1008,22 +1008,23 @@ function testDeinflections() {
const deinflector = new Deinflector(deinflectionReasons);

describe('deinflections', () => {
for (const {valid, tests} of data) {
// for (const {valid, tests} of data) {
describe.each(data)('$category', ({valid, tests}) => {
for (const {source, term, rule, reasons} of tests) {
const {has} = hasTermReasons(deinflector, source, term, rule, reasons);
let message = `${source} ${valid ? 'has' : 'does not have'} term candidate ${JSON.stringify(term)}`;
if (typeof rule !== 'undefined') {
message += ` with rule ${JSON.stringify(rule)}`;
}
if (typeof reasons !== 'undefined') {
if (reasons !== null) {
message += (typeof rule !== 'undefined' ? ' and' : ' with');
message += ` reasons ${JSON.stringify(reasons)}`;
}
test(`${message}`, () => {
expect(has).toStrictEqual(valid);
});
}
}
});
});
}

Expand Down

0 comments on commit 0805f85

Please sign in to comment.