31 lines
1.8 KiB
Gherkin
31 lines
1.8 KiB
Gherkin
Feature: SPA test runner (Vitest + Vue Test Utils)
|
|
|
|
As the maintainer of RenewCMS
|
|
I want a `task test:web` command that runs Vitest against the Vue 3 SPA
|
|
So that SPA behaviour is verified by a real, automated test run instead of being reported as NOT RUN
|
|
|
|
Background:
|
|
Given web/ has vitest and @vue/test-utils installed as devDependencies, added via bun
|
|
And web/ has a Vitest config (jsdom environment) that discovers test files under web/src
|
|
And Taskfile.yml defines a `test:web` task that installs frontend dependencies if needed and then runs the SPA test suite from the web/ directory in run (non-watch) mode
|
|
|
|
Scenario: A component test exists and exercises real component output
|
|
Given web/src/views/HomeView.vue renders a paragraph with the text "Home"
|
|
And a Vue Test Utils test mounts HomeView and asserts that the rendered text includes "Home"
|
|
When `task test:web` is run
|
|
Then the process exits with code 0
|
|
And the output reports at least 1 passed test
|
|
|
|
Scenario: task test:web fails the build when a component assertion is wrong
|
|
Given the HomeView component test instead asserts that the rendered text includes "Goodbye"
|
|
When `task test:web` is run
|
|
Then the process exits with a nonzero code
|
|
And the output reports that test as failed, naming the file and the assertion that did not match
|
|
|
|
Scenario: task test:web runs standalone without the Go test suite or a built SPA
|
|
Given internal/infrastructure/assets/dist/ does not exist (the SPA has not been built)
|
|
And no Go test process is running
|
|
When `task test:web` is run
|
|
Then Vitest runs against web/src directly via Vite, with no dependency on the Go binary, the embedded dist/ assets or a live server
|
|
And the command's exit code alone determines pass or fail
|