Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
test: add link and link-install test
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde authored and othiym23 committed Mar 27, 2015
1 parent 3cf3b0c commit 5811468
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/tap/link-install/package.json
@@ -0,0 +1,11 @@
{
"name": "bar",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
50 changes: 50 additions & 0 deletions test/tap/link.js
@@ -0,0 +1,50 @@
var path = require("path")
var test = require("tap").test
var common = require("../common-tap.js")
var link = path.join(__dirname, "link")
var linkInstall = path.join(__dirname, "link-install")

test("setup", function (t) {
common.npm(["ls", "-g", "--depth=0"], {}, function (err, c, out) {
t.ifError(err)
t.equal(c, 0, "set up ok")
t.notOk(out.match(/UNMET DEPENDENCY foo@/), "foo isn't in global")
t.end()
})
});

test("creates global link", function (t) {
process.chdir(link)
common.npm("link", {}, function (err,c , out) {
t.ifError(err, "link has no error")
common.npm(["ls", "-g"], {}, function (err, c, out) {
t.ifError(err)
t.equal(c, 0)
t.has(out, /foo@1.0.0/, "creates global link ok")
t.end()
})
})
})

test("link-install the package", function (t) {
process.chdir(linkInstall)
common.npm(["link", "foo"], {}, function (err) {
t.ifError(err, "link-install has no error")
common.npm("ls", {}, function (err, c, out) {
t.ifError(err)
t.equal(c, 1)
t.has(out, /foo@1.0.0/, "link-install ok")
t.end()
})
});
})

test("cleanup", function (t) {
common.npm(["rm", "foo"], {}, function (err, code) {
t.equal(code, 0, "cleanup foo in local ok")
common.npm(["rm", "-g", "foo"], {}, function (err, code) {
t.equal(code, 0, "cleanup foo in global ok")
t.end()
})
})
})
11 changes: 11 additions & 0 deletions test/tap/link/package.json
@@ -0,0 +1,11 @@
{
"name": "foo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

0 comments on commit 5811468

Please sign in to comment.