UNPKG

1.35 kBJavaScriptView Raw
1/* globals suite, test */
2/* jshint node: true, esnext: false, expr: true */
3/* jscs: disable */
4'use strict';
5
6var addonIndex = require('../index');
7var assert = require('chai').assert;
8
9describe('Index', function() {
10
11 beforeEach(function() {
12 addonIndex.treeGenerator = function(dir) {
13 return dir;
14 };
15 });
16
17 describe('#_findPluginsFor', function() {
18 it('grabs all plugins from a project', function() {
19 var project = {
20 addons: [
21 { name: 'one', pkg: { keywords: ['ember-addon'] } },
22 { name: 'two', pkg: { keywords: ['ember-addon', 'ember-service-worker-plugin'] } }
23 ]
24 };
25
26 var addons = addonIndex._findPluginsFor(project);
27
28 assert.equal(addons.length, 1, 'It should find one addon');
29 assert.equal(addons[0].name, 'two', 'The addon named "two" should be found');
30 });
31 });
32
33 describe('#included', () => {
34 it('sets default options', () => {
35 const scope = { _super: {} };
36 addonIndex.included.call(scope, { env: 'prod' });
37
38 let expected = {
39 'ember-service-worker': {
40 serviceWorkerFilename: 'sw.js',
41 enabled: true,
42 registrationStrategy: 'default'
43 },
44 'fingerprint': {
45 exclude: ['sw.js']
46 }
47 };
48
49 assert.deepEqual(scope.app.options, expected);
50 });
51 });
52});