You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
768 B

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)
}