| Server IP : 157.230.181.24 / Your IP : 216.73.217.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/vhosts/convo/node_modules/normalize-package-data/test/ |
Upload File : |
var test = require("tap").test
var normalize = require("../")
test("strict", function(t) {
var threw
try {
threw = false
normalize({name: "X"}, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid name: "X"')
} finally {
t.equal(threw, true)
}
try {
threw = false
normalize({name:" x "}, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid name: " x "')
} finally {
t.equal(threw, true)
}
try {
threw = false
normalize({name:"x",version:"01.02.03"}, true)
} catch (er) {
threw = true
t.equal(er.message, 'Invalid version: "01.02.03"')
} finally {
t.equal(threw, true)
}
// these should not throw
var slob = {name:" X ",version:"01.02.03",dependencies:{
y:">01.02.03",
z:"! 99 $$ASFJ(Aawenf90awenf as;naw.3j3qnraw || an elephant"
}}
normalize(slob, false)
t.same(slob,
{ name: 'X',
version: '1.2.3',
dependencies:
{ y: '>01.02.03',
z: '! 99 $$ASFJ(Aawenf90awenf as;naw.3j3qnraw || an elephant' },
readme: 'ERROR: No README data found!',
_id: 'X@1.2.3' })
t.end()
})