@api-client/core 0.18.39 → 0.18.40
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/RELEASE_SETUP.md +4 -2
- package/build/src/sdk/SdkMock.d.ts +49 -45
- package/build/src/sdk/SdkMock.d.ts.map +1 -1
- package/build/src/sdk/SdkMock.js +94 -90
- package/build/src/sdk/SdkMock.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +6 -6
- package/package.json +3 -2
- package/src/sdk/SdkMock.ts +428 -295
- package/TESTING_READY.md +0 -114
package/TESTING_READY.md
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# Testing Setup Complete! 🎉
|
|
2
|
-
|
|
3
|
-
Your API Client Core project now has a comprehensive testing setup with documentation and utilities.
|
|
4
|
-
|
|
5
|
-
## What's Been Added
|
|
6
|
-
|
|
7
|
-
### 📚 Documentation
|
|
8
|
-
|
|
9
|
-
- **`TESTING_SETUP.md`** - Complete testing guide and reference
|
|
10
|
-
- **Test Templates** - Ready-to-use templates for new tests
|
|
11
|
-
|
|
12
|
-
### 🛠️ Utilities
|
|
13
|
-
|
|
14
|
-
- **`tests/test-utils.ts`** - Common testing utilities and helpers
|
|
15
|
-
- **`tests/example-test-setup.ts`** - Working examples of test patterns
|
|
16
|
-
- **`tests/template-node.spec.ts`** - Template for Node.js tests
|
|
17
|
-
- **`test/template-browser.test.ts`** - Template for browser tests
|
|
18
|
-
|
|
19
|
-
### ⚡ VS Code Tasks
|
|
20
|
-
|
|
21
|
-
- **Test: Run All Tests** - Runs both Node.js and browser tests
|
|
22
|
-
- Additional test tasks available in the Command Palette
|
|
23
|
-
|
|
24
|
-
## Quick Start
|
|
25
|
-
|
|
26
|
-
### Run All Tests
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm test
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Run Node.js Tests Only
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm run test:node
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Run Browser Tests Only
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm run test:browser
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Run Tests with Coverage
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm run test:coverage
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Run Tests in Watch Mode
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
npm run test:browser:watch
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Your Testing Stack
|
|
57
|
-
|
|
58
|
-
### Node.js Tests (Japa)
|
|
59
|
-
|
|
60
|
-
- **Location**: `tests/unit/**/*.spec.ts`
|
|
61
|
-
- **Framework**: Japa with Assert plugin
|
|
62
|
-
- **Features**: Sinon mocking, API client testing, type checking
|
|
63
|
-
- **Run with**: `npm run test:node`
|
|
64
|
-
|
|
65
|
-
### Browser Tests (Web Test Runner)
|
|
66
|
-
|
|
67
|
-
- **Location**: `test/**/*.browser.test.ts` or `test/**/*.spec.ts`
|
|
68
|
-
- **Framework**: Web Test Runner with Chai
|
|
69
|
-
- **Features**: Playwright automation, OAuth2 mock server, DOM testing
|
|
70
|
-
- **Run with**: `npm run test:browser`
|
|
71
|
-
|
|
72
|
-
## File Naming Conventions
|
|
73
|
-
|
|
74
|
-
- **Node.js tests**: `*.spec.ts` in `tests/unit/`
|
|
75
|
-
- **Browser tests**: `*.browser.test.ts` or `*.spec.ts` in `test/`
|
|
76
|
-
- **Shared utilities**: Place in `test/` directory
|
|
77
|
-
|
|
78
|
-
## Next Steps
|
|
79
|
-
|
|
80
|
-
1. **Review the documentation** in `TESTING_SETUP.md`
|
|
81
|
-
2. **Explore the examples** in `test/example-test-setup.ts`
|
|
82
|
-
3. **Use the templates** to create new tests:
|
|
83
|
-
- Copy `test/template-node.spec.ts` for Node.js tests
|
|
84
|
-
- Copy `test/template-browser.test.ts` for browser tests
|
|
85
|
-
4. **Run the existing tests** to ensure everything works
|
|
86
|
-
5. **Write tests for your modules** using the patterns shown
|
|
87
|
-
|
|
88
|
-
## Testing Best Practices
|
|
89
|
-
|
|
90
|
-
✅ **Separate Node.js and browser tests** - Use appropriate file naming
|
|
91
|
-
✅ **Use test utilities** - Leverage `TestUtils` for common operations
|
|
92
|
-
✅ **Mock external dependencies** - Use Sinon for consistent mocking
|
|
93
|
-
✅ **Test both success and error cases** - Ensure comprehensive coverage
|
|
94
|
-
✅ **Group related tests** - Use test groups for better organization
|
|
95
|
-
✅ **Clean up after tests** - Restore mocks and clean up resources
|
|
96
|
-
|
|
97
|
-
## Available Test Utilities
|
|
98
|
-
|
|
99
|
-
- `TestUtils.createMockResponse()` - HTTP response mocking
|
|
100
|
-
- `TestUtils.createTestRequest()` - HTTP request creation
|
|
101
|
-
- `TestUtils.generateTestData()` - Random test data
|
|
102
|
-
- `TestUtils.assertThrows()` - Error testing
|
|
103
|
-
- `TestUtils.mockFetch()` - Fetch API mocking
|
|
104
|
-
- `BrowserTestUtils.waitForElement()` - DOM element waiting
|
|
105
|
-
- `BrowserTestUtils.createMockLocalStorage()` - Storage mocking
|
|
106
|
-
|
|
107
|
-
## Need Help?
|
|
108
|
-
|
|
109
|
-
- Check `TESTING_SETUP.md` for detailed documentation
|
|
110
|
-
- Look at existing tests in `tests/unit/` for examples
|
|
111
|
-
- Review the templates for common patterns
|
|
112
|
-
- Run tests with `--verbose` flag for more output
|
|
113
|
-
|
|
114
|
-
Happy testing! 🚀
|