2024-06-15 19:36:55 +09:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: dakkar and other Sharkey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2024-02-21 05:00:22 +09:00
|
|
|
import { describe, test, assert, afterEach } from 'vitest';
|
|
|
|
import { nyaize } from '@/scripts/nyaize.js';
|
|
|
|
|
|
|
|
function runTests(cases) {
|
|
|
|
for (const c of cases) {
|
|
|
|
const [input,expected] = c;
|
|
|
|
const got = nyaize(input);
|
|
|
|
assert.strictEqual(got, expected);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('nyaize', () => {
|
|
|
|
test('ja-JP', () => {
|
|
|
|
runTests([
|
|
|
|
['きれいな','きれいにゃ'],
|
|
|
|
['ナナナ', 'ニャニャニャ'],
|
|
|
|
['ナナ','ニャニャ'],
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
test('en-US', () => {
|
|
|
|
runTests([
|
|
|
|
['bar','bar'],
|
|
|
|
['banana','banyanya'],
|
|
|
|
['booting','booting'],
|
|
|
|
['morning','mornyan'],
|
|
|
|
['mmmorning','mmmornyan'],
|
|
|
|
['someone','someone'],
|
|
|
|
['everyone','everynyan'],
|
|
|
|
['foreveryone','foreverynyan'],
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|