meteor / meteor/validated-method

Unit Test Examples

Open
#54 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
193
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Could you provide some unit test examples or a pattern for using a framework like chai? I am using the Meteor Chef's Base template, and I am trying to extend [this file](https://github.com/themeteorchef/base/blob/master/imports/api/documents/methods.tests.js) to include a test for when the insertDocument.call() function fails validation and throws an Error.

I have tried a ton of different things, but I can't seem to get it to work. Could you provide some sample code for that?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with imports/api/documents/methods.tests.js from the linked Meteor Chef Base template and review how insertDocument.call() is currently tested. Add a clear example or pattern for testing the validation failure that throws an Error, using the requested framework style where appropriate. Done means the example shows the failure assertion and can be used to extend that test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.