forked from VOICEVOX/voicevox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
テスト実行環境Docker関連ファイルと単体テスト例 (VOICEVOX#291)
* テスト実行環境DockerファイルとStore/Vue.js createStoreのテスト * Add rust and cargo into dockerfile * Import path refine
- Loading branch information
1 parent
9a405fe
commit 9eaad39
Showing
4 changed files
with
150 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:14.17.4 | ||
|
||
WORKDIR /opt | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup_install.sh | ||
RUN chmod 755 rustup_install.sh | ||
RUN echo 1 | sh rustup_install.sh -y | ||
ENV PATH="/root/.cargo/bin:$PATH" | ||
RUN cargo install typos-cli | ||
COPY . /work | ||
WORKDIR /work | ||
RUN npm ci | ||
EXPOSE 3000 | ||
|
||
CMD ["/bin/sh"] |
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,33 @@ | ||
version: '3' | ||
services: | ||
test: | ||
build: . | ||
working_dir: /work | ||
# If you don't have node_modules, use "npm ci", install node_modules into the yor directory. | ||
# Use command bellow | ||
# `docker-compose up -d --build` | ||
# The container will stop automatically after install | ||
# If you have node_modules already, you comment out '# command: "npm ci"' | ||
|
||
# command: "npm ci" | ||
|
||
|
||
# After node_modules install, use command bellow to exec "/bin/sh" and the container will remain. | ||
# `docker-compose up -d` | ||
# To access container, use command bellow | ||
# `docker exec -it voicevox_test_1 /bin/bash` | ||
|
||
# command: "/bin/sh" | ||
|
||
|
||
# If you want test automatically (test runs when you save any files), use this command property and view logs | ||
# Use Command bellow | ||
# `docker logs --tail 1000 -f voicevox_test_1` | ||
|
||
command: "npm run test-watch:unit " | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- .:/work:cache | ||
tty: true | ||
stdin_open: true |
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
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,101 @@ | ||
import { createLogger } from "vuex"; | ||
import { indexStore } from "@/store/index"; | ||
import { createStore } from "@/store/vuex"; | ||
import { AllActions, AllGetters, AllMutations, State } from "@/store/type"; | ||
import { commandStore } from "@/store/command"; | ||
import { audioStore, audioCommandStore } from "@/store/audio"; | ||
import { projectStore } from "@/store/project"; | ||
import { uiStore } from "@/store/ui"; | ||
import { settingStore } from "@/store/setting"; | ||
import { assert } from "chai"; | ||
const isDevelopment = process.env.NODE_ENV == "development"; | ||
// TODO: Swap external files to Mock | ||
|
||
describe("store/vuex.js test", () => { | ||
it("creaete store", () => { | ||
const store = createStore<State, AllGetters, AllActions, AllMutations>({ | ||
state: { | ||
engineState: "STARTING", | ||
audioItems: {}, | ||
audioKeys: [], | ||
audioStates: {}, | ||
uiLockCount: 0, | ||
audioDetailPaneOffset: undefined, | ||
audioInfoPaneOffset: undefined, | ||
nowPlayingContinuously: false, | ||
undoCommands: [], | ||
redoCommands: [], | ||
useUndoRedo: isDevelopment, | ||
useGpu: false, | ||
isHelpDialogOpen: false, | ||
isSettingDialogOpen: false, | ||
isMaximized: false, | ||
savingSetting: { | ||
fileEncoding: "UTF-8", | ||
fixedExportEnabled: false, | ||
fixedExportDir: "", | ||
avoidOverwrite: false, | ||
}, | ||
isPinned: false, | ||
}, | ||
getters: { | ||
...uiStore.getters, | ||
...audioStore.getters, | ||
...commandStore.getters, | ||
...projectStore.getters, | ||
...settingStore.getters, | ||
...audioCommandStore.getters, | ||
...indexStore.getters, | ||
}, | ||
mutations: { | ||
...uiStore.mutations, | ||
...audioStore.mutations, | ||
...commandStore.mutations, | ||
...projectStore.mutations, | ||
...settingStore.mutations, | ||
...audioCommandStore.mutations, | ||
...indexStore.mutations, | ||
}, | ||
actions: { | ||
...uiStore.actions, | ||
...audioStore.actions, | ||
...commandStore.actions, | ||
...projectStore.actions, | ||
...settingStore.actions, | ||
...audioCommandStore.actions, | ||
...indexStore.actions, | ||
}, | ||
plugins: isDevelopment ? [createLogger()] : undefined, | ||
strict: process.env.NODE_ENV !== "production", | ||
}); | ||
assert.exists(store); | ||
assert.isObject(store); | ||
assert.isObject(store.state); | ||
assert.equal(store.state.engineState, "STARTING"); | ||
assert.isObject(store.state.audioItems); | ||
assert.isEmpty(store.state.audioItems); | ||
assert.isArray(store.state.audioKeys); | ||
assert.isEmpty(store.state.audioKeys); | ||
assert.isObject(store.state.audioStates); | ||
assert.isEmpty(store.state.audioStates); | ||
assert.equal(store.state.uiLockCount, 0); | ||
assert.isUndefined(store.state.audioDetailPaneOffset); | ||
assert.isUndefined(store.state.audioInfoPaneOffset); | ||
assert.equal(store.state.nowPlayingContinuously, false); | ||
assert.isArray(store.state.undoCommands); | ||
assert.isEmpty(store.state.undoCommands); | ||
assert.isArray(store.state.redoCommands); | ||
assert.isEmpty(store.state.redoCommands); | ||
assert.equal(store.state.useUndoRedo, false); | ||
assert.equal(store.state.useGpu, false); | ||
assert.equal(store.state.isHelpDialogOpen, false); | ||
assert.equal(store.state.isSettingDialogOpen, false); | ||
assert.equal(store.state.isMaximized, false); | ||
assert.isObject(store.state.savingSetting); | ||
assert.propertyVal(store.state.savingSetting, "fileEncoding", "UTF-8"); | ||
assert.propertyVal(store.state.savingSetting, "fixedExportEnabled", false); | ||
assert.propertyVal(store.state.savingSetting, "fixedExportDir", ""); | ||
assert.propertyVal(store.state.savingSetting, "avoidOverwrite", false); | ||
assert.equal(store.state.isPinned, false); | ||
}); | ||
}); |