@crashbytes/react-version-compare 1.0.3 → 1.0.4
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 +89 -6
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -2,16 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
A React component for comparing strings and arrays with precise word-level and item-level highlighting of differences.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@crashbytes/react-version-compare)
|
|
6
|
+
[](https://www.npmjs.com/package/@crashbytes/react-version-compare)
|
|
6
7
|
[](LICENSE)
|
|
8
|
+
[](https://github.com/CrashBytes/react-version-compare/actions/workflows/security-audit.yml)
|
|
9
|
+
[](https://github.com/CrashBytes/react-version-compare/security/code-scanning)
|
|
10
|
+
[](https://github.com/CrashBytes/react-version-compare/actions/workflows/react-compat.yml)
|
|
11
|
+
[](https://github.com/CrashBytes/react-version-compare/actions/workflows/react-compat.yml)
|
|
12
|
+
[](https://www.npmjs.com/package/@crashbytes/react-version-compare)
|
|
13
|
+
[](https://crashbytes.github.io/react-version-compare/coverage/)
|
|
14
|
+
[](https://crashbytes.github.io/react-version-compare/coverage/)
|
|
7
15
|
|
|
8
|
-
## Live
|
|
16
|
+
## Live Demos
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
### Interactive Storybook
|
|
11
19
|
|
|
12
|
-
👉 **[Live Storybook Demo](https://crashbytes.github.io/react-version-compare/)**
|
|
20
|
+
👉 **[Live Storybook Demo](https://crashbytes.github.io/react-version-compare/storybook/)**
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
Explore and interact with all features of this component. Adjust inputs and props using the controls panel to see how the component behaves with different data.
|
|
23
|
+
|
|
24
|
+
### Test Coverage Report
|
|
25
|
+
|
|
26
|
+
📊 **[View Coverage Report](https://crashbytes.github.io/react-version-compare/coverage/)**
|
|
27
|
+
|
|
28
|
+
Detailed test coverage metrics showing 99.31% statement coverage, 94.39% branch coverage, and 100% function coverage.
|
|
15
29
|
|
|
16
30
|
## Features
|
|
17
31
|
|
|
@@ -23,6 +37,7 @@ The Storybook provides interactive examples for all comparison scenarios. You ca
|
|
|
23
37
|
- 📱 **Responsive**: Works on desktop and mobile devices
|
|
24
38
|
- ⚡ **TypeScript Support**: Full TypeScript definitions included
|
|
25
39
|
- 🎛️ **Multiple Views**: Side-by-side or inline comparison modes
|
|
40
|
+
- ✅ **Comprehensive Testing**: 80%+ test coverage with 114+ test scenarios
|
|
26
41
|
|
|
27
42
|
## Installation
|
|
28
43
|
|
|
@@ -161,6 +176,55 @@ const modified = ['Item A', 'Modified Item B', 'Item C', 'Item D'];
|
|
|
161
176
|
/>
|
|
162
177
|
```
|
|
163
178
|
|
|
179
|
+
## Testing
|
|
180
|
+
|
|
181
|
+
This package includes comprehensive unit and integration tests with 80%+ coverage.
|
|
182
|
+
|
|
183
|
+
### Running Tests
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Run all tests
|
|
187
|
+
npm test
|
|
188
|
+
|
|
189
|
+
# Run tests with coverage report
|
|
190
|
+
npm run test:coverage
|
|
191
|
+
|
|
192
|
+
# Run tests in watch mode (for development)
|
|
193
|
+
npm run test:watch
|
|
194
|
+
|
|
195
|
+
# Run specific test file
|
|
196
|
+
npm test -- Compare.enhanced.test.tsx
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Test Coverage
|
|
200
|
+
|
|
201
|
+
The test suite includes:
|
|
202
|
+
- **114+ test scenarios** covering edge cases and real-world usage
|
|
203
|
+
- **Unit tests**: Component logic, utility functions, type guards
|
|
204
|
+
- **Integration tests**: Real-world scenarios (code snippets, JSON, SQL, URLs)
|
|
205
|
+
- **Edge case tests**: Empty inputs, null/undefined, large datasets, unicode
|
|
206
|
+
- **Accessibility tests**: Semantic structure, screen reader support
|
|
207
|
+
- **Performance tests**: Large arrays (100+ items), large strings (1000+ words)
|
|
208
|
+
|
|
209
|
+
Coverage thresholds enforced by Jest:
|
|
210
|
+
- Branches: 75%
|
|
211
|
+
- Functions: 80%
|
|
212
|
+
- Lines: 80%
|
|
213
|
+
- Statements: 80%
|
|
214
|
+
|
|
215
|
+
See [TEST-COVERAGE-SUMMARY.md](./TEST-COVERAGE-SUMMARY.md) for detailed test documentation.
|
|
216
|
+
|
|
217
|
+
### Test Files
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
__tests__/
|
|
221
|
+
├── Compare.test.tsx # Original basic tests
|
|
222
|
+
├── Compare.enhanced.test.tsx # Edge cases & comprehensive coverage
|
|
223
|
+
├── Compare.integration.test.tsx # Real-world scenarios
|
|
224
|
+
├── ContentfulDiff.test.tsx # Original utility tests
|
|
225
|
+
└── ContentfulDiff.enhanced.test.tsx # Complete utility coverage
|
|
226
|
+
```
|
|
227
|
+
|
|
164
228
|
## Styling
|
|
165
229
|
|
|
166
230
|
The component uses CSS classes that you can customize:
|
|
@@ -205,6 +269,25 @@ Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
|
|
205
269
|
|
|
206
270
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
207
271
|
|
|
272
|
+
### Development Setup
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Install dependencies
|
|
276
|
+
npm install
|
|
277
|
+
|
|
278
|
+
# Run tests
|
|
279
|
+
npm test
|
|
280
|
+
|
|
281
|
+
# Run tests with coverage
|
|
282
|
+
npm run test:coverage
|
|
283
|
+
|
|
284
|
+
# Build the package
|
|
285
|
+
npm run build
|
|
286
|
+
|
|
287
|
+
# Run Storybook for local development
|
|
288
|
+
npm run storybook
|
|
289
|
+
```
|
|
290
|
+
|
|
208
291
|
## Support
|
|
209
292
|
|
|
210
293
|
If you encounter any issues or have questions, please [open an issue](https://github.com/CrashBytes/react-version-compare/issues) on GitHub.
|
|
@@ -221,4 +304,4 @@ To bump the version, use [npm version](https://docs.npmjs.com/cli/v10/commands/n
|
|
|
221
304
|
npm version patch # or 'minor' or 'major'
|
|
222
305
|
```
|
|
223
306
|
|
|
224
|
-
This will update `package.json`, create a git tag, and (optionally) commit the change.
|
|
307
|
+
This will update `package.json`, create a git tag, and (optionally) commit the change.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crashbytes/react-version-compare",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A React component for comparing strings and arrays with precise word-level and item-level highlighting of differences.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"test": "jest --no-coverage",
|
|
19
19
|
"test:coverage": "jest --coverage",
|
|
20
20
|
"test:watch": "jest --watch",
|
|
21
|
+
"coverage:report": "jest --coverage && open coverage/lcov-report/index.html",
|
|
22
|
+
"coverage:deploy": "npm run test:coverage && gh-pages -d coverage/lcov-report -e coverage",
|
|
21
23
|
"clean": "rm -rf dist",
|
|
22
24
|
"prepublishOnly": "npm run clean && npm run build",
|
|
23
25
|
"lint": "eslint src --ext .ts,.tsx",
|
|
@@ -27,7 +29,9 @@
|
|
|
27
29
|
"storybook": "storybook dev -p 6006",
|
|
28
30
|
"build-storybook": "storybook build",
|
|
29
31
|
"storybook:build": "storybook build",
|
|
30
|
-
"storybook:deploy": "
|
|
32
|
+
"storybook:deploy": "npm run build-storybook && gh-pages -d storybook-static",
|
|
33
|
+
"deploy:all": "npm run test:coverage && npm run build-storybook && npm run deploy:combined",
|
|
34
|
+
"deploy:combined": "node scripts/deploy-gh-pages.js"
|
|
31
35
|
},
|
|
32
36
|
"keywords": [
|
|
33
37
|
"react",
|