Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Unit Test Services without DB Dependency #184

Merged
merged 48 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
bcc77c9
Create health router
joneubank Jun 23, 2023
8c9978d
Dictionary Routes moved into router
joneubank Jun 23, 2023
a93cffa
Comments and minor changes
joneubank Jun 23, 2023
01120c0
Refactor clients for external services into `/external` directory
joneubank Jun 23, 2023
abe3f78
Enforce TS strict and fix type issues
joneubank Jun 23, 2023
981f4a8
Major version bump, add immer and zod
joneubank Jun 24, 2023
c686bc9
Remove explicit paths declaration and rules redundant with strict
joneubank Jun 24, 2023
3c27775
Copyright year update
joneubank Jun 24, 2023
599822e
Dictionary Schema defined with Zod
joneubank Jun 24, 2023
9e29b36
Move dictionary model to `/db` dir and base off new types
joneubank Jun 24, 2023
b2e30dc
Move diff code to a service
joneubank Jun 24, 2023
6462db5
Clean types, validate request inputs
joneubank Jun 24, 2023
12b055a
Update types and db code reference
joneubank Jun 24, 2023
a6d17d0
Move express handler wrappers to /routers dir
joneubank Jun 24, 2023
c371a7a
Clean up types, use immer for immutable changes
joneubank Jun 24, 2023
53ac45a
Handle ZodErrors thrown during requests
joneubank Jun 24, 2023
ea21e9d
Use new types
joneubank Jun 24, 2023
38c26d6
Put `/diff` first to ensure it does not get blocked by `/:id` requests
joneubank Jun 24, 2023
f4b1f88
Small type fixes
joneubank Jun 24, 2023
39d40d7
Update tests and fixtures to work with latest type validations
joneubank Jun 24, 2023
b4cbb0e
Provide some basic schema examples
joneubank Jun 24, 2023
895f54f
Remove unused meta-schema
joneubank Jun 24, 2023
d92ee39
Move /diff to its own router
joneubank Jun 24, 2023
ffbb2af
Organize all imports
joneubank Jun 24, 2023
bdcbbbf
Diff request path back to original
joneubank Jun 24, 2023
bbfcee3
Organize Imports
joneubank Jun 24, 2023
bbc0f8f
Mocha Testing Config separate from npm scripts
joneubank Jul 4, 2023
a5abccb
Explicitly set `noImplicitAny` to enforce array.map type inference on…
joneubank Jul 4, 2023
b21b351
Move Reference Types to their own file
joneubank Jul 4, 2023
dfac2f4
Refactor references utilities to use proper reference types
joneubank Jul 4, 2023
66867fc
Move reference test fixtures and fix linebreak normalization tests
joneubank Jul 4, 2023
bbc9961
Remove console logs
joneubank Jun 25, 2023
2bcc6e6
Add endpoints to fetch schema/field directly
joneubank Jun 25, 2023
ffa8acd
Fix missing field check, Error message cleanup
joneubank Jun 25, 2023
3ec517b
Update new endpoint summary and description
joneubank Jun 25, 2023
9b90d85
Prettier formatting
joneubank Jun 26, 2023
7755d09
Add sinon and chai-as-promised
joneubank Jun 26, 2023
06abd41
Add common access methods to dictionary repository
joneubank Jun 26, 2023
bb738e4
Rename tests with *.spec.ts pattern
joneubank Jun 26, 2023
4bc25fd
Dictionary/Schema test fixtures with checked types, organized and sim…
joneubank Jun 26, 2023
4af7a34
Typo fix: primative -> primitive
joneubank Jun 26, 2023
3276321
Separate DB and service methods with testing
joneubank Jun 26, 2023
3266ab5
Remove console logs
joneubank Jul 4, 2023
296d72a
Merge branch 'develop' into refactor/unit-test-cleanup
joneubank Jul 5, 2023
e78f93d
Add `isArray` property to fields to match original meta-schema
joneubank Jul 5, 2023
fef879c
Spelling correction primitive
joneubank Jul 5, 2023
a73d21c
Clean descriptions mentioning meta schema
joneubank Jul 5, 2023
b037a15
Fix comment
joneubank Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hooks": {
"pre-push": "npm run test"
}
"hooks": {
"pre-push": "npm run test"
}
}
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extension": ["ts"],
"require": "ts-node/register",
"spec": "test/**/*.ts",
"spec": "test/**/*.spec.ts",
"timeout": 35000
}
185 changes: 183 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,26 @@
"devDependencies": {
"@types/body-parser": "^1.19.2",
"@types/chai": "^4.1.7",
"@types/chai-as-promised": "^7.1.5",
"@types/errorhandler": "0.0.32",
"@types/express": "^4.17.13",
"@types/jsonwebtoken": "^8.3.2",
"@types/lodash": "^4.14.136",
"@types/memoizee": "^0.4.7",
"@types/mocha": "^5.2.7",
"@types/ms": "^0.7.31",
"@types/sinon": "^10.0.15",
"@types/swagger-ui-express": "^3.0.1",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"chai-http": "^4.3.0",
"concurrently": "^5.3.0",
"gitmoji-cli": "^4.8.0",
"husky": "^3.1.0",
"mocha": "^9.2.0",
"nodemon": "^2.0.15",
"prettier": "^2.8.0",
"sinon": "^15.2.0",
"testcontainers": "^1.1.19",
"ts-node": "^10.0.0",
"typescript": "^5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions samples/dictionary/simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "1.0",
"schemas": [
{
"name": "primatives",
"description": "Includes one field of each primative type without any restrictions. No Frills.",
"name": "primitives",
"description": "Includes one field of each primitive type without any restrictions. No Frills.",
"fields": [
{ "name": "boolean_field", "valueType": "boolean" },
{ "name": "integer_field", "valueType": "integer" },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "primatives",
"description": "Includes one field of each primative type without any restrictions. No Frills.",
"name": "primitives",
"description": "Includes one field of each primitive type without any restrictions. No Frills.",
"fields": [
{ "name": "boolean_field", "valueType": "boolean" },
{ "name": "integer_field", "valueType": "integer" },
Expand Down
Loading