-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add additional tests for different implementations (#20)
* chore: silence vercel comments * test: add separate tests for different xstate implementations * test: add requirement for machine to be defined
- Loading branch information
1 parent
3e2d73b
commit 762b60a
Showing
12 changed files
with
120 additions
and
29 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,18 @@ | ||
/** | ||
* @vitest-environment node | ||
*/ | ||
import { fileURLToPath } from 'node:url' | ||
import { describe } from 'vitest' | ||
import { setup } from '@nuxt/test-utils' | ||
|
||
import runTests from './tests' | ||
|
||
describe('Minimal implementation of the module', async () => { | ||
await setup({ | ||
server: true, | ||
browser: true, | ||
rootDir: fileURLToPath(new URL('../fixture/minimal', import.meta.url)) | ||
}) | ||
|
||
runTests() | ||
}) |
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,18 @@ | ||
/** | ||
* @vitest-environment node | ||
*/ | ||
import { fileURLToPath } from 'node:url' | ||
import { describe } from 'vitest' | ||
import { setup } from '@nuxt/test-utils' | ||
|
||
import runTests from './tests' | ||
|
||
describe('Regular implementation of the module', async () => { | ||
await setup({ | ||
server: true, | ||
browser: true, | ||
rootDir: fileURLToPath(new URL('../fixture/regular', import.meta.url)) | ||
}) | ||
|
||
runTests() | ||
}) |
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
File renamed without changes.
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,13 @@ | ||
import { defineNuxtConfig } from 'nuxt/config' | ||
import XStateModule from '../../../' | ||
|
||
// Fixture module used mostly for testing when using the minimal option | ||
export default defineNuxtConfig({ | ||
modules: [ | ||
// @ts-ignore-next-line | ||
XStateModule | ||
], | ||
xState: { | ||
minimal: true | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
<template> | ||
<div> | ||
<h1>Current state: <span data-test-id="state-txt">{{ state.value }}</span></h1> | ||
<button data-test-id="click-btn" @click="send('CLICK')"> | ||
CLICK | ||
</button> | ||
<p data-test-id="machine"> | ||
{{ machine }} | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
const machine = useMachine(loadingMachine) | ||
const { state, send } = machine | ||
</script> |
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,17 @@ | ||
export default createMachine({ | ||
id: 'loading', | ||
initial: 'idle', | ||
predictableActionArguments: true, | ||
states: { | ||
idle: { | ||
on: { | ||
CLICK: 'loading' | ||
} | ||
}, | ||
loading: { | ||
on: { | ||
CLICK: 'idle' | ||
} | ||
} | ||
} | ||
}) |
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,13 @@ | ||
import { defineNuxtConfig } from 'nuxt/config' | ||
import XStateModule from '../../../' | ||
|
||
// Fixture module used mostly for testing when using the minimal option | ||
export default defineNuxtConfig({ | ||
modules: [ | ||
// @ts-ignore-next-line | ||
XStateModule | ||
], | ||
xState: { | ||
minimal: false | ||
} | ||
}) |
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,5 @@ | ||
{ | ||
"github": { | ||
"silent": 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