Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

unit test for node project (teams for education)

robertrodini1
robertrodini1

How to use the Input field for unit tests for node projects in Teams for Education? The online documentation doesn't use it. Is that because it is not implemented?

P.S. I would like to link to my Teams For Education example but I can't so I used change-calculator-CLI which is similar but not identical.

1 year ago
You are viewing a single comment. View All
1
robertrodini1
robertrodini1

I've done some research and I think the answer may lie within the jest testing support for mocks. I would need to mock stdin since that's how I get simple input:

var fs = require("fs"); var input = fs.readFileSync(0).toString();

I would need help from Replit staff to see how to fit the mock into their use of jest. Here are a couple of articles on jest mocking:
https://medium.com/@altshort/unit-testing-node-cli-apps-with-jest-2cd4adc599fb
https://jestjs.io/docs/manual-mocks#mocking-node-modules

1 year ago