Skip to content

Commit

Permalink
test: プロジェクトファイルをマイグレーションしたあとにスナップショットテスト (#2354)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Nov 16, 2024
1 parent 258c791 commit 3499820
Show file tree
Hide file tree
Showing 7 changed files with 7,067 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
src/openapi/**/* linguist-generated=true
openapi.json linguist-generated=true

**/__snapshots__/**/*.snap linguist-generated=true

*.woff2 linguist-vendored=true

* text=auto eol=lf
3 changes: 2 additions & 1 deletion src/domain/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
DEFAULT_TPQN,
DEFAULT_TRACK_NAME,
} from "@/sing/domain";
import { uuid4 } from "@/helpers/random";

const DEFAULT_SAMPLING_RATE = 24000;

Expand Down Expand Up @@ -297,7 +298,7 @@ export const migrateProjectFileObject = async (
track.mute = false;
track.gain = 1;
track.pan = 0;
newTracks[TrackId(crypto.randomUUID())] = track;
newTracks[TrackId(uuid4())] = track;
}
projectData.song.tracks = newTracks;
projectData.song.trackOrder = Object.keys(newTracks);
Expand Down
3 changes: 2 additions & 1 deletion src/store/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
showAlertDialog,
showQuestionDialog,
} from "@/components/Dialog/Dialog";
import { uuid4 } from "@/helpers/random";

export const projectStoreState: ProjectStoreState = {
savedLastCommandIds: { talk: null, song: null },
Expand Down Expand Up @@ -125,7 +126,7 @@ export const projectStore = createPartialStore<ProjectStoreTypes>({
await context.actions.SET_TIME_SIGNATURES({
timeSignatures: [createDefaultTimeSignature(1)],
});
const trackId = TrackId(crypto.randomUUID());
const trackId = TrackId(uuid4());
await context.actions.SET_TRACKS({
tracks: new Map([[trackId, createDefaultTrack()]]),
});
Expand Down
4 changes: 2 additions & 2 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ const singingPitchCache = new Map<SingingPitchKey, SingingPitch>();
const singingVolumeCache = new Map<SingingVolumeKey, SingingVolume>();
const singingVoiceCache = new Map<SingingVoiceKey, SingingVoice>();

const initialTrackId = TrackId(crypto.randomUUID());
const initialTrackId = TrackId(uuid4());

/**
* シーケンスの音源の出力を取得する。
Expand Down Expand Up @@ -1577,7 +1577,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({

CREATE_TRACK: {
action() {
const trackId = TrackId(crypto.randomUUID());
const trackId = TrackId(uuid4());
const track = createDefaultTrack();

return { trackId, track };
Expand Down
Loading

0 comments on commit 3499820

Please sign in to comment.