Skip to content

Commit

Permalink
追加: ConfigManagerに全設定を取得するメソッドを追加し、スナップショットテストを更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed Nov 16, 2024
1 parent 3499820 commit 1ae518e
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/backend/common/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ export abstract class BaseConfigManager {
this._save();
}

/** 全ての設定を取得する。テスト用。 */
public getAll(): ConfigType {
if (!this.config) throw new Error("Config is not initialized");
return this.config;
}

private _save() {
void this.lock.acquire(lockKey, async () => {
await this.save({
Expand Down
239 changes: 239 additions & 0 deletions tests/unit/backend/common/__snapshots__/configManager.spec.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/unit/backend/common/configManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ for (const [version, data] of pastConfigs) {
const configManager = new TestConfigManager();
await configManager.initialize();
expect(configManager).toBeTruthy();
expect(configManager.getAll()).toMatchSnapshot();

Check failure on line 88 in tests/unit/backend/common/configManager.spec.ts

View workflow job for this annotation

GitHub Actions / unit-test

../tests/unit/backend/common/configManager.spec.ts > 0.13.0からマイグレーションできる

Error: Snapshot `0.13.0からマイグレーションできる 1` mismatched - Expected + Received @@ -64,11 +64,11 @@ "action": "テキスト欄を追加", "combination": "Shift Enter", }, { "action": "テキスト欄を複製", - "combination": "Meta D", + "combination": "Ctrl D", }, { "action": "テキスト欄を削除", "combination": "Shift Delete", }, @@ -116,67 +116,67 @@ "action": "選択中のアクセント句のイントネーションをリセット", "combination": "R", }, { "action": "コピー", - "combination": "Meta C", + "combination": "Ctrl C", }, { "action": "切り取り", - "combination": "Meta X", + "combination": "Ctrl X", }, { "action": "貼り付け", - "combination": "Meta V", + "combination": "Ctrl V", }, { "action": "すべて選択", - "combination": "Meta A", + "combination": "Ctrl A", }, { "action": "選択解除", "combination": "", }, { "action": "1番目のキャラクターを選択", - "combination": "Meta 1", + "combination": "Ctrl 1", }, { "action": "2番目のキャラクターを選択", - "combination": "Meta 2", + "combination": "Ctrl 2", }, { "action": "3番目のキャラクターを選択", - "combination": "Meta 3", + "combination": "Ctrl 3", }, { "action": "4番目のキャラクターを選択", - "combination": "Meta 4", + "combination": "Ctrl 4", }, { "action": "5番目のキャラクターを選択", - "combination": "Meta 5", + "combination": "Ctrl 5", }, { "action": "6番目のキャラクターを選択", - "combination": "Meta 6", + "combination": "Ctrl 6", }, { "action": "7番目のキャラクターを選択", - "combination": "Meta 7", + "combination": "Ctrl 7", }, { "action": "8番目のキャラクターを選択", - "combination": "Meta 8", + "combination": "Ctrl 8", }, { "action": "9番目のキャラクターを選択", - "combination": "Meta 9", + "combination": "Ctrl 9", }, { "action": "10番目のキャラクターを選択", - "combination": "Meta 0", + "combination": "Ctrl 0", }, ], "inheritAudioInfo": true, "playheadPositionDisplayFormat": "MINUTES_SECONDS", "presets": { ❯ ../tests/unit/backend/common/configManager.spec.ts:88:36
});
}

Expand Down

0 comments on commit 1ae518e

Please sign in to comment.