forked from ytgov/sfa-client
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dev Tooling: Add Basic Test Suite Setup To Project #17
Merged
datajohnson
merged 27 commits into
test
from
issue-16/dev-tooling--add-basic-test-suite-setup-to-project
Aug 11, 2023
Merged
Dev Tooling: Add Basic Test Suite Setup To Project #17
datajohnson
merged 27 commits into
test
from
issue-16/dev-tooling--add-basic-test-suite-setup-to-project
Aug 11, 2023
Conversation
This file contains 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
Might want to add a basic knex file and load that in the config.ts?
|
fb55b71
to
3d254a0
Compare
Base automatically changed from
issue-14/dev-tooling-add-root-alias-support
to
test
August 8, 2023 22:16
e9d3ce3
to
228e549
Compare
Usage: - dev npm run console
I'll probably need to add in extra stuff to handle testing express endpoints.
In the future the test database will be separate from the regular one.
> A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them. The database instance should probably be loaded globally or in some kind of helper and close globally as well, rather than just in this file.
I _want_ this to only run on app _boot_. I also want to figure out how to set the default schema.
How? by using the hacked db schema instance instead. This is clearly not a wining strategy.
…able. It needs npm exec ts-node -r tsconfig-paths/register to run.
Use kebab case for file names.
Note: using default knex for schema migrations.
Note that I'm using the custom db client for backfilling as it has a cleaner interface.
Note that there are no migrations in the test setup, so all database tests will fail.
52a33d1
to
bdc04e7
Compare
31564a2
to
16b2066
Compare
Why? They exist in production and the the Knex system will crash if it can't find all the migrations that it expects. They can be deleted once the relevant rows are removed from the dbo.knex_migrations table in production.
This will create the `SFADB_DEV` and `sfa_client_test` databases.
Why? To avoid cluttering the repo with private mssql content.
bb0a0ea
to
5eee5b4
Compare
I left this migration in, instead of deleting it, as it is a very good example.
069fc14
to
2fa28e2
Compare
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.
Fixes #16
Depends on:
Context
Create a basic test suite setup for the api.
Also created basic migration pipeline. It currently needs way more migrations and some kind of initial schema load, but I'm deferring that for now.
TODO
Notes
Testing Instructions
dev test
will watch the tests and re-run when a test is saved.src/api/tests/db/db-client.test.ts
and see that the test suite re-runs