forked from moul/node-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtils.test.coffee
More file actions
21 lines (17 loc) · 786 Bytes
/
Utils.test.coffee
File metadata and controls
21 lines (17 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
chai = require 'chai'
expect = chai.expect
proxyquire = require 'proxyquire'
Utils = require '../lib/Utils.js'
describe "Utils", ->
describe "parseProjectId", ->
it "should return a Number if passed a Number", ->
expect(Utils.parseProjectId 0).to.be.a 'number'
it "should URI encode strings containing '/'", ->
expect(Utils.parseProjectId "/abc").to.equal '%2Fabc'
expect(Utils.parseProjectId "a/bc").to.equal 'a%2Fbc'
expect(Utils.parseProjectId "ab/c").to.equal 'ab%2Fc'
expect(Utils.parseProjectId "abc/").to.equal 'abc%2F'
it "should return NaN for unparseable strings without '/'", ->
expect(isNaN Utils.parseProjectId "abc").to.be.true
it "should return a Number for parseable strings without '/'", ->
expect(Utils.parseProjectId "1").to.equal 1