@flightdev/testing 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @flightdev/testing
|
|
2
2
|
|
|
3
3
|
Testing utilities for Flight Framework. Test components, routes, and server actions with ease.
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ Testing utilities for Flight Framework. Test components, routes, and server acti
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install -D @
|
|
20
|
+
npm install -D @flightdev/testing
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
---
|
|
@@ -27,7 +27,7 @@ npm install -D @flight-framework/testing
|
|
|
27
27
|
```typescript
|
|
28
28
|
// vitest.config.ts
|
|
29
29
|
import { defineConfig } from 'vitest/config';
|
|
30
|
-
import { flightTestPlugin } from '@
|
|
30
|
+
import { flightTestPlugin } from '@flightdev/testing/vitest';
|
|
31
31
|
|
|
32
32
|
export default defineConfig({
|
|
33
33
|
plugins: [flightTestPlugin()],
|
|
@@ -44,7 +44,7 @@ export default defineConfig({
|
|
|
44
44
|
### React Components
|
|
45
45
|
|
|
46
46
|
```tsx
|
|
47
|
-
import { render, screen } from '@
|
|
47
|
+
import { render, screen } from '@flightdev/testing/react';
|
|
48
48
|
import { Button } from './Button';
|
|
49
49
|
|
|
50
50
|
test('renders button with text', () => {
|
|
@@ -64,7 +64,7 @@ test('calls onClick when clicked', async () => {
|
|
|
64
64
|
### Vue Components
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import { mount } from '@
|
|
67
|
+
import { mount } from '@flightdev/testing/vue';
|
|
68
68
|
import Button from './Button.vue';
|
|
69
69
|
|
|
70
70
|
test('renders button', async () => {
|
|
@@ -84,7 +84,7 @@ test('renders button', async () => {
|
|
|
84
84
|
### Test Loaders
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
import { createTestContext } from '@
|
|
87
|
+
import { createTestContext } from '@flightdev/testing';
|
|
88
88
|
import { loader } from './blog/[slug].page';
|
|
89
89
|
|
|
90
90
|
test('loader returns post data', async () => {
|
|
@@ -108,7 +108,7 @@ test('loader throws 404 for missing post', async () => {
|
|
|
108
108
|
### Test Actions
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
|
-
import { createTestContext } from '@
|
|
111
|
+
import { createTestContext } from '@flightdev/testing';
|
|
112
112
|
import { action } from './contact.page';
|
|
113
113
|
|
|
114
114
|
test('action creates contact submission', async () => {
|
|
@@ -130,7 +130,7 @@ test('action creates contact submission', async () => {
|
|
|
130
130
|
## Server Action Testing
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
|
-
import { createActionTest } from '@
|
|
133
|
+
import { createActionTest } from '@flightdev/testing';
|
|
134
134
|
import { submitForm } from './actions';
|
|
135
135
|
|
|
136
136
|
test('submitForm validates input', async () => {
|
|
@@ -183,7 +183,7 @@ const { user, rerender, unmount } = render(
|
|
|
183
183
|
### Mock Utilities
|
|
184
184
|
|
|
185
185
|
```typescript
|
|
186
|
-
import { mockFetch, mockLoader, mockAction } from '@
|
|
186
|
+
import { mockFetch, mockLoader, mockAction } from '@flightdev/testing';
|
|
187
187
|
|
|
188
188
|
// Mock fetch globally
|
|
189
189
|
mockFetch({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightdev/testing",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Testing utilities for Flight Framework applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
"unit-test"
|
|
46
46
|
],
|
|
47
47
|
"license": "MIT",
|
|
48
|
+
"homepage": "https://github.com/EliosLT/FlightDev",
|
|
49
|
+
"repository": {
|
|
50
|
+
"url": "https://github.com/EliosLT/FlightDev.git",
|
|
51
|
+
"directory": "packages/testing",
|
|
52
|
+
"type": "git"
|
|
53
|
+
},
|
|
48
54
|
"scripts": {
|
|
49
55
|
"build": "tsc",
|
|
50
56
|
"dev": "tsc --watch"
|