Welcome to mirror list, hosted at ThFree Co, Russian Federation.

check-platform.js « test « npm-install-checks « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eeeb1bceffa293ecc5fe0c6fd8c14cd4acc34458 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var test = require("tap").test
var c = require("../index.js").checkPlatform

test("target cpu wrong", function (t) {
  var target = {}
  target.cpu = "enten-cpu"
  target.os = "any"
  c(target, false, function (err) {
    t.ok(err, "error present")
    t.equal(err.code, "EBADPLATFORM")
    t.end()
  })
})

test("os wrong", function (t) {
  var target = {}
  target.cpu = "any"
  target.os = "enten-os"
  c(target, false, function (err) {
    t.ok(err, "error present")
    t.equal(err.code, "EBADPLATFORM")
    t.end()
  })
})

test("nothing wrong", function (t) {
  var target = {}
  target.cpu = "any"
  target.os = "any"
  c(target, false, function (err) {
    t.notOk(err, "no error present")
    t.end()
  })
})

test("force", function (t) {
  var target = {}
  target.cpu = "enten-cpu"
  target.os = "any"
  c(target, true, function (err) {
    t.notOk(err, "no error present")
    t.end()
  })
})