forked from VOICEVOX/voicevox
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into EngineInfoManagerのリファクタリング
- Loading branch information
Showing
3 changed files
with
37 additions
and
43 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
21 changes: 0 additions & 21 deletions
21
tests/unit/domain/defaultEngine/defaultEngine.node.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
tests/unit/domain/defaultEngine/latetDefaultEngine.spec.ts
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,16 @@ | ||
import latestDefaultEngineInfos from "./latestDefaultEngineInfos.json"; | ||
import { fetchLatestDefaultEngineInfo } from "@/domain/defaultEngine/latetDefaultEngine"; | ||
|
||
test("fetchLatestDefaultEngineInfo", async () => { | ||
// テスト用のjsonファイルでfetchをモックする | ||
// 元ファイルは https://raw.githubusercontent.com/VOICEVOX/voicevox_blog/master/src/generateLatestDefaultEngineInfos.ts | ||
const spy = vi | ||
.spyOn(global, "fetch") | ||
.mockResolvedValue(new Response(JSON.stringify(latestDefaultEngineInfos))); | ||
|
||
// 読み込めることを確認 | ||
const infos = await fetchLatestDefaultEngineInfo("https://example.com/"); | ||
expect(infos.formatVersion).toBe(1); | ||
|
||
spy.mockRestore(); | ||
}); |