Skip to content

Commit

Permalink
Fixes #53 - allow null and undefined args to be unrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencec committed Apr 8, 2018
1 parent d0a64a5 commit f4d2a06
Show file tree
Hide file tree
Showing 8 changed files with 10,384 additions and 743 deletions.
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"semi": [
2,
"always"
]
],
"immutable/no-let": 2,
"immutable/no-this": 2,
"immutable/no-mutation": 2
},
"env": {
"browser": true,
Expand All @@ -20,6 +23,9 @@
"extends": [
"standard"
],
"plugins": [
"immutable"
],
"globals": {
"window": true,
"describe": true,
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,45 @@ Note, that objects and arrays need to be stringified first:
`
);

# Null and undefined values

To test for undefined null and undefined values, use the following syntax. This is because there is an error check to see
if all required values have been passed and values of null and undefined defeat that test. A replacement value is used to state
the intention but the actual value of null or undefined will be passed to the test.

```
unroll('should be okay with id being #id', (done, testArgs) => {
let object = { id: testArgs.id };
expect(object.id).toEqual(testArgs.id);
done();
},
`
where:
id
${Symbol.keyFor(unroll.NULL)}
${Symbol.keyFor(unroll.UNDEFINED)}
`
);
and the array notation:

unroll('should be okay with id being #id', (done, testArgs) => {
let object = { id: testArgs.id };
expect(object.id).toEqual(testArgs.id);
done();
},
[
['id']
[null],
[undefined],
[Unroll.NULL],
[Unroll.UNDEFINED],
]


```

make

## Examples

The following example is the same shown in examples/mocha-bdd-example.js file. It can be run using Mocha eg:
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// eslint-disable-next-line immutable/no-mutation
module.exports = require('./lib/unroll');

0 comments on commit f4d2a06

Please sign in to comment.