Skip to content

Mocha tests#165

Closed
jSadoski wants to merge 14 commits intobillimarie:masterfrom
jSadoski:mocha-tests
Closed

Mocha tests#165
jSadoski wants to merge 14 commits intobillimarie:masterfrom
jSadoski:mocha-tests

Conversation

@jSadoski
Copy link
Contributor

Added Packages

Atmosphere:

*These packages don't load in production

NPM devDependencies:

  • chai: Includes the assert library for tests
  • faker: Generate bulk fake data for testing

These packages will be bundled in production unless meteor npm prune --production is used to remove the devDependancies!

Added scripts

Run with meteor npm [script]

Unit testing:

  • test: Runs one test (without loading the client), eager-loading any *.test.js files present in the directory (files under a ./test/ directory are ignored )
  • test-watch: Build & run test server, hot reloading on file changes. Server tests will happen in the command line, and the same tests are available on the client by opening localhost:3000. Very useful for unit testing during development!

Integration testing (client):

  • test-app: Build & run the full stack, including client, then run tests once. Loads any *.app-test.js files present outside of ./test/ (does not load *.test.js files).
  • test-app-watch: Build & run full stack, including client. Hot reload on file changes, just like meteor run. Also inserts a <div> with test results at the top of the page.

Note that for test-watch, Iron Router appends a routing error to the end of the page. This is because the client isn't being delivered as IR expects it to be. It doesn't interfere with the function of the script, it's just an eyesore. I haven't adressed it, because I figured it would change with #158.

Also note that you cannot meteor mongo while a test instance is running because a test instance uses a test database on port :3001. If you have a local mongo client, you can connect with mongo meteor --port 3001.

At present, I haven't written any Integration tests due to difficulty with the current publications. I'm having trouble figuring out the best method to subscribe to a publication that includes all attorneys in the client, given how the current publications are structured. I wanted to get this PR out before moving on to inegration tests.

@jSadoski
Copy link
Contributor Author

Quick note on 35612ae (denodeify utility): It's very useful for some of the integration tests I'm trying to implement.

@jSadoski jSadoski closed this by deleting the head repository Jan 29, 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.

1 participant