Fix test
This commit is contained in:
parent
e298316df7
commit
681548038d
|
@ -57,7 +57,7 @@ export function createWordMuteInfo(mutedWords: Array<string | string[]>) : WordM
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWordMuteInfo(mutedWords: Array<string | string[]>, hardMutedWords: Array<string | string[]>): void {
|
export function setWordMuteInfo(mutedWords: Array<string | string[]>, hardMutedWords: Array<string | string[]>): void {
|
||||||
const soft = createWordMuteInfo(mutedWords);
|
const soft = createWordMuteInfo(mutedWords);
|
||||||
const hard = createWordMuteInfo(hardMutedWords);
|
const hard = createWordMuteInfo(hardMutedWords);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, test, assert } from 'vitest';
|
import { describe, test, assert } from 'vitest';
|
||||||
import { createWordMuteInfo, checkWordMute } from '@/utility/check-word-mute.js';
|
import { checkWordMute, setWordMuteInfo } from '@/utility/check-word-mute.js';
|
||||||
import { NoteMock } from './mocks.js';
|
import { NoteMock } from './mocks.js';
|
||||||
|
|
||||||
type TestCases = {
|
type TestCases = {
|
||||||
|
@ -63,10 +63,7 @@ describe('check-word-mute', () => {
|
||||||
cases.forEach((c) => {
|
cases.forEach((c) => {
|
||||||
test(`text: ${c.text}, cw: ${c.cw}, mutedWords: ${c.mutedWords}` , async () => {
|
test(`text: ${c.text}, cw: ${c.cw}, mutedWords: ${c.mutedWords}` , async () => {
|
||||||
// initWordMuteInfoが実行されないので代わりにここで初期化
|
// initWordMuteInfoが実行されないので代わりにここで初期化
|
||||||
(globalThis as any)._misskeyWordMute = {
|
setWordMuteInfo(c.mutedWords, []);
|
||||||
soft: createWordMuteInfo(c.mutedWords),
|
|
||||||
hard: createWordMuteInfo([]),
|
|
||||||
}
|
|
||||||
|
|
||||||
const note = NoteMock({ text: c.text, cw: c.cw });
|
const note = NoteMock({ text: c.text, cw: c.cw });
|
||||||
const result = checkWordMute(note, null, 'soft');
|
const result = checkWordMute(note, null, 'soft');
|
||||||
|
|
Loading…
Reference in New Issue