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

Add basic server smoke test #91

Merged
merged 1 commit into from
Oct 4, 2023
Merged

Add basic server smoke test #91

merged 1 commit into from
Oct 4, 2023

Conversation

alexrudd2
Copy link
Owner

See upstream version nornagon#187

This is a basic smoke test to make sure the Express server starts
(sometimes dependency updates break it).

@alexrudd2 alexrudd2 requested a review from jedahan October 3, 2023 19:17
@alexrudd2 alexrudd2 marked this pull request as ready for review October 3, 2023 19:17
@@ -11,8 +11,9 @@ import { EBB } from "./ebb";
import { Device, PenMotion, Motion, Plan } from "./planning";
import { formatDuration } from "./util";
import { autoDetect } from '@serialport/bindings-cpp';
import * as self from './server' // for mocking
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a link to documentation for this? Its a new pattern to me, but otherwise this looks good!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its just a little weird to me, like wouldn't you get infinite recursive imports?

Copy link
Owner Author

@alexrudd2 alexrudd2 Oct 4, 2023

Choose a reason for hiding this comment

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

Exporting the function was the only way I found that allowed jest to mock it. It doesn't appear to recurse (presumably after the first export jest "grabs" it and stops the recursion?)

I have no idea if it's a good pattern or not; it was trial-and-error.

@alexrudd2 alexrudd2 merged commit bdf03b2 into main Oct 4, 2023
3 checks passed
@alexrudd2 alexrudd2 deleted the test-server branch October 4, 2023 15:56
alexrudd2 added a commit that referenced this pull request Oct 26, 2023
alexrudd2 added a commit that referenced this pull request Oct 26, 2023
alexrudd2 added a commit that referenced this pull request Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants