|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +var StashService = require('../stash'); |
| 4 | + |
| 5 | +describe('module/stash', function() { |
| 6 | + var stashService; |
| 7 | + var options; |
| 8 | + |
| 9 | + beforeEach(function() { |
| 10 | + options = { |
| 11 | + url: 'url', |
| 12 | + user: 'user', |
| 13 | + password: 'password' |
| 14 | + }; |
| 15 | + }); |
| 16 | + |
| 17 | + describe('constructor', function() { |
| 18 | + describe('with invalid args', function() { |
| 19 | + it('throws with non object', function() { |
| 20 | + assert.throws(function() { |
| 21 | + stashService = new StashService(); |
| 22 | + }); |
| 23 | + |
| 24 | + assert.throws(function() { |
| 25 | + stashService = new StashService('foo'); |
| 26 | + }); |
| 27 | + }); |
| 28 | + |
| 29 | + describe('throws without', function() { |
| 30 | + afterEach(function() { |
| 31 | + assert.throws(function() { |
| 32 | + stashService = new StashService(options); |
| 33 | + }); |
| 34 | + }); |
| 35 | + |
| 36 | + it('url', function() { |
| 37 | + delete options.url; |
| 38 | + }); |
| 39 | + |
| 40 | + it('user', function() { |
| 41 | + delete options.user; |
| 42 | + }); |
| 43 | + |
| 44 | + it('user', function() { |
| 45 | + delete options.user; |
| 46 | + }); |
| 47 | + }); |
| 48 | + |
| 49 | + it('does not throw with all args', function() { |
| 50 | + assert.doesNotThrow(function() { |
| 51 | + stashService = new StashService(options); |
| 52 | + }); |
| 53 | + }); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
| 57 | + describe('functions', function() { |
| 58 | + beforeEach(function() { |
| 59 | + stashService = new StashService(options); |
| 60 | + }); |
| 61 | + |
| 62 | + it('#serviceKey is stash', function() { |
| 63 | + assert.equal(stashService.serviceKey, 'stash'); |
| 64 | + }); |
| 65 | + }); |
| 66 | +}); |
0 commit comments