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

Tests for functions that interact with system state #483

Merged
merged 5 commits into from
Apr 1, 2023

Conversation

cychu42
Copy link
Contributor

@cychu42 cychu42 commented Mar 30, 2023

Closes #482

Changes

  • Add tests for the file ~\models\system-state.server.ts.
  • Adjust setIsReconciliationNeeded() to allow initialize() to execute, in cases where the system state row doesn't exist in database table SystemState. Previously, it instead produces a serialization error and does not execute the function call for initialize() in the catch block.

Test

  1. setup test database via npm run setup:test
  2. run the test file via npm run test system-state.server.test.ts

@cychu42 cychu42 added this to the Milestone 0.8 milestone Mar 30, 2023
@cychu42 cychu42 self-assigned this Mar 30, 2023
@cychu42 cychu42 requested a review from a user March 30, 2023 20:07
@Genne23v Genne23v added the category: testing Unit tests, end to end tests label Mar 31, 2023
@cychu42 cychu42 requested a review from Genne23v March 31, 2023 19:03
app/models/system-state.server.ts Outdated Show resolved Hide resolved
test/unit/system-state.server.test.ts Show resolved Hide resolved
* Make sure tests restore default state
@cychu42
Copy link
Contributor Author

cychu42 commented Mar 31, 2023

I updated the code. Thank you for suggesting a different way of adjusting setIsReconciliationNeeded.

test/unit/system-state.server.test.ts Outdated Show resolved Hide resolved
@cychu42 cychu42 requested a review from Eakam1007 March 31, 2023 21:32
Copy link
Contributor

@Eakam1007 Eakam1007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing, otherwise looks great

app/models/system-state.server.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Genne23v Genne23v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cychu42 cychu42 merged commit 91a6acf into DevelopingSpace:main Apr 1, 2023
@cychu42
Copy link
Contributor Author

cychu42 commented Apr 1, 2023

Thank you all for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: testing Unit tests, end to end tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests for functions that interact with system state
4 participants