UNPKG

1.31 kBtext/coffeescriptView Raw
1should = require 'should'
2
3getAxiomModules = require '../lib/getAxiomModules'
4
5
6tests = [
7 description: "should get only 'axiom'-prefixed extension modules"
8 pkg:
9 dependencies:
10 'axiom-hello': '*'
11 'axiom-world': '*'
12 'not-axiom': '*'
13 'also-not-axiom': '*'
14 blacklist: null
15 expected: ['hello', 'world']
16 ,
17 description: "should get extension modules from 'devDependencies'"
18 pkg:
19 dependencies:
20 'axiom-hello': '*'
21 'not-axiom': '*' # should not appear
22 devDependencies:
23 'axiom-world': '*'
24 'also-not-axiom': '*' # should not appear
25 blacklist: null
26 expected: ['hello', 'world']
27 ,
28 description: "should not get duplicates from 'dependencies', 'devDependencies'"
29 pkg:
30 dependencies:
31 'axiom-a': '*'
32 'axiom-b': '*' # duplicated
33 devDependencies:
34 'axiom-b': '*' # duplicated
35 'axiom-c': '*'
36 blacklist: null
37 expected: ['a', 'b', 'c']
38]
39
40describe 'getAxiomModules', ->
41 for test in tests
42 do (test) ->
43
44 # Given a parsed 'package.json' and a blacklist
45 {description, pkg, blacklist, expected} = test
46
47 it description, (done) ->
48
49 # When we call the function
50 result = getAxiomModules pkg, blacklist
51
52 # We get the expected result
53 result.should.eql expected
54
55 done()