Skip to content

Commit 5ffaa8a

Browse files
committed
fix(test): added test for null private field
1 parent cd9c1e1 commit 5ffaa8a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@ suite('create-package-json', () => {
212212
assert.strictEqual(pkg.private, true);
213213
});
214214

215+
// Remove null/undefined keys
216+
test('remove null/undefined keys', async () => {
217+
await fix.setup();
218+
const pkg = await createPackageJson({
219+
private: null
220+
});
221+
222+
assert.strictEqual(pkg.private, undefined);
223+
});
224+
215225
test('scaffold scripts', async () => {
216226
await fix.setup();
217227
const pkg = await createPackageJson();
@@ -276,10 +286,10 @@ suite('create-package-json', () => {
276286
assert.deepStrictEqual(pkg.scripts, npmInitPkg.scripts);
277287
assert.deepStrictEqual(pkg.keywords, npmInitPkg.keywords);
278288
assert.strictEqual(pkg.license, npmInitPkg.license);
289+
assert.strictEqual(pkg.type, npmInitPkg.type);
279290

280291
// Should be different
281292
assert.notStrictEqual(pkg.author, npmInitPkg.author, JSON.stringify([pkg.author, npmInitPkg.author]));
282-
assert.notStrictEqual(pkg.type, npmInitPkg.type, JSON.stringify([pkg.type, npmInitPkg.type]));
283293
});
284294
});
285295
});

0 commit comments

Comments
 (0)