Fix: aiscriptディレクトリ内の型エラー解消と単体テスト (#15191)
* AiScript APIの型エラーに対処 * AiScript UI APIのテスト作成 * onInputなどがPromiseを返すように * AiScript共通APIのテスト作成 * CHANGELOG記載 * 定数のテストをconcurrentに * vi.mockを使用 * misskeyApiをmisskeyApiUntypedのエイリアスとする * 期待されるエラーメッセージを修正 * Mk:removeのテスト * misskeyApiの型を変更
This commit is contained in:
23
packages/frontend/test/aiscript/common.test.ts
Normal file
23
packages/frontend/test/aiscript/common.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { assertStringAndIsIn } from "@/scripts/aiscript/common.js";
|
||||
import { values } from "@syuilo/aiscript";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
describe('AiScript common script', () => {
|
||||
test('assertStringAndIsIn', () => {
|
||||
expect(
|
||||
() => assertStringAndIsIn(values.STR('a'), ['a', 'b'])
|
||||
).not.toThrow();
|
||||
expect(
|
||||
() => assertStringAndIsIn(values.STR('c'), ['a', 'b'])
|
||||
).toThrow('"c" is not in "a", "b"');
|
||||
expect(() => assertStringAndIsIn(
|
||||
values.STR('invalid'),
|
||||
['left', 'center', 'right']
|
||||
)).toThrow('"invalid" is not in "left", "center", "right"');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user