Skip to content

Commit 23e82a5

Browse files
committed
Fix #21 objectContent with null value
1 parent 718319c commit 23e82a5

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- v5
5-
- v4
6-
- '0.12'
7-
- '0.10'
4+
- node
5+
- 6
6+
- 4
7+
- 0.12

fixtures/dummy.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"a": {"b": 1},
33
"b": [1, 2],
4-
"c": "a"
4+
"c": "a",
5+
"d": null
56
}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ assert.notImplement = function (subject, methods) {
206206

207207
assert.objectContent = function (obj, content) {
208208
Object.keys(content).forEach(function (key) {
209-
if (typeof content[key] === 'object') {
209+
if (_.isObject(content[key])) {
210210
assert.objectContent(obj[key], content[key]);
211211
return;
212212
}
@@ -223,7 +223,7 @@ assert.objectContent = function (obj, content) {
223223

224224
assert.noObjectContent = function (obj, content) {
225225
Object.keys(content).forEach(function (key) {
226-
if (typeof content[key] === 'object') {
226+
if (_.isObject(content[key])) {
227227
assert.noObjectContent(obj[key], content[key]);
228228
return;
229229
}

test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ describe('yeoman-assert', function () {
284284
it('pass if file contains the keys', function () {
285285
assert.doesNotThrow(yoAssert.jsonFileContent.bind(yoAssert, file, {
286286
a: {b: 1},
287-
b: [1, 2]
287+
b: [1, 2],
288+
d: null
288289
}));
289290
});
290291

0 commit comments

Comments
 (0)