feat: comprehensive tests and react 19 support#1023
Open
losboss wants to merge 19 commits into
Open
Conversation
Add comprehensive tests for SearchIndex covering SHORTCODES_REGEX, get(), search(), and reset() with mocked config/Data. Also expand config.test.js with full coverage of init(), getProps(), and getProp().
Adds 35 tests covering init(), getProps(), and getProp() behaviors including data loading, emoticon/native maps, alias processing, search string building, custom categories, filtering, and type coercion edge cases.
Add 13 new test cases covering fetchJSON CDN fetch and caching, caller warning, re-init custom category filtering, non-English i18n fetch, custom category target assignment, categoryIcons, noCountryFlags SafeFlags filtering, and latestVersionSupport version filtering. Coverage: 86% → 100% statements/lines, 93.45% branches, 100% functions.
Mock the canvas context and navigator.userAgent to test the IIFE detection path that normally only runs in real browsers. Covers pixel comparison, measureText width check, color matching, and caching behavior.
Node 16 is EOL since September 2023. Update to Node 20 LTS (20.18.3) which is required by @testing-library/react@16.
Replace React.createElement with JSX syntax, remove default React import, and add package-level tsconfig to scope React's JSX runtime. Remove jsxImportSource from root tsconfig since Parcel auto-detects it from package.json dependencies.
The root tsconfig had jsxImportSource set to preact, but the React wrapper package needs React's JSX runtime. Parcel 2.6.2 doesn't respect package-level tsconfigs, so we remove jsxImportSource from root and set it explicitly in each package.
Adds a jsdom-based test suite for the React wrapper using @testing-library/react and a mocked Picker class to validate renders, prop passing, re-renders, and unmount. Configures ts-jest in jest.config.js to include @types/jest and jsxImportSource=react.
8c162e6 to
8cc2bc8
Compare
- TypeScript 4.6.4 → 5.8.3 (required for modern @types/node) - Jest 28 → 29, ts-jest 28 → 29 (required for TS 5) - Parcel 2.6.2 → 2.16.4 (required for TS 5 type generation) - Add per-package tsconfigs with include scoping - Update check:types to run per-package type checking - Add coverage/ to .prettierignore
|
@EtienneLem any change to have some updates on this package? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Missive conversation: https://mail.missiveapp.com/#inbox/conversations/201ba9c1-249a-40e0-8371-9f91444dfe79