[optikt-app] Test coverage infrastructure + 469 new unit tests (Phase 0–2)#31
Draft
[optikt-app] Test coverage infrastructure + 469 new unit tests (Phase 0–2)#31
Conversation
…I workflow Agent-Logs-Url: https://github.com/Optikt/optikt-app/sessions/ba46b228-9632-4493-aa44-c4bd330bbeca Co-authored-by: NanezX <81595884+NanezX@users.noreply.github.com>
Add spec files for opticalRange, prescription, products, csv, and generateUUID utils with 70 tests covering all exports, edge cases, and null handling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: NanezX <81595884+NanezX@users.noreply.github.com>
Add test coverage for auth, brands, customers, exchangeRates, lenses, reports, search, settings, suppliers, and users schemas. Tests cover: - Valid inputs with safeParse success - Required field validation - Invalid types and boundary lengths - Default value application - Transform behavior (trim, lowercase, coercion) - Refinements and cross-field validation - Edge cases (empty strings, boundary values) 220 tests across 10 new spec files, all passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: NanezX <81595884+NanezX@users.noreply.github.com>
Add 133 tests across 8 new spec files covering: - purchaseTypes (status, item type, labels, badge colors) - currencyTypes (codes, labels, symbols, base currency) - lensTypes (6 enums, labels, badge colors) - supplierTypes (types, labels, badge colors) - inventoryTypes (movements, references, adjustments, loss reasons) - salesTypes (status, payment, discount, refund) - contracts/common (PatientEye enum) - contracts/search (SearchScope, prefixes, labels) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: NanezX <81595884+NanezX@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Optikt/optikt-app/sessions/ba46b228-9632-4493-aa44-c4bd330bbeca Co-authored-by: NanezX <81595884+NanezX@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
NanezX
April 12, 2026 18:26
View session
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.
Test coverage was ~9% with 361 tests across 25 spec files. This PR establishes coverage measurement infrastructure and adds comprehensive tests for all pure functions, schemas, enums, and server-side logic that require no database.
Phase 0: Coverage Infrastructure
@vitest/coverage-v8, addedtest:coveragescriptvite.config.ts(text, lcov, json-summary reporters)--coverageand uploads reports as artifactsPhase 1: Pure Function Tests (+423 tests)
opticalRange,prescription,products,csv,generateUUIDauth,brands,customers,exchangeRates,lenses,reports,search,settings,suppliers,users— validates parsing, transforms, refinements, defaultspurchaseTypes,currencyTypes,lensTypes,supplierTypes,inventoryTypes,salesTypes,common,search— covers enum values, label functions, badge colors, predicates, fallbacksPhase 2: Server-Side Logic (+46 tests)
guards.spec.ts— mocks$app/serverand@sveltejs/kiterror to testrequireAuth,requireRole,requireAdmin,requireSuperuser(401/403 paths)audit/utils.spec.ts—calculateDiff,createChangeRecordForCreate,createChangeRecordForDelete,hasChangesincluding excluded fields, Date normalization, nested objectsResult
Pre-existing failure (
auth.spec.tsrequiresDATABASE_URL) is unchanged. Remaining untested areas (DB queries, remote functions, components, routes, E2E) are tracked for Phase 3–6.