1 | should = require 'should'
|
2 |
|
3 | getAxiomModules = require '../lib/getAxiomModules'
|
4 |
|
5 |
|
6 | tests = [
|
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': '*'
|
22 | devDependencies:
|
23 | 'axiom-world': '*'
|
24 | 'also-not-axiom': '*'
|
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': '*'
|
33 | devDependencies:
|
34 | 'axiom-b': '*'
|
35 | 'axiom-c': '*'
|
36 | blacklist: null
|
37 | expected: ['a', 'b', 'c']
|
38 | ]
|
39 |
|
40 | describe 'getAxiomModules', ->
|
41 | for test in tests
|
42 | do (test) ->
|
43 |
|
44 |
|
45 | {description, pkg, blacklist, expected} = test
|
46 |
|
47 | it description, (done) ->
|
48 |
|
49 |
|
50 | result = getAxiomModules pkg, blacklist
|
51 |
|
52 |
|
53 | result.should.eql expected
|
54 |
|
55 | done()
|