blob: 473596eef2c65f5a8b72e0e959450fe202615b14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
var tap = require("tap")
var normalize = require("../lib/normalize")
var path = require("path")
var fs = require("fs")
tap.test("bad scripts", function (t) {
var p = path.resolve(__dirname, "./fixtures/badscripts.json")
fs.readFile (p, function (err, contents) {
if (err) throw err
var originalData = JSON.parse(contents.toString())
var data = JSON.parse(contents.toString())
normalize(data)
t.ok(data)
verifyFields(t, data, originalData)
t.end()
})
})
function verifyFields (t, normalized, original) {
t.equal(normalized.version, original.version, "Version field stays same")
t.equal(normalized.name, original.name, "Name stays the same.")
// scripts is not an object, so it should be deleted
t.notOk(normalized.scripts)
}
|