1 | RedisPooledJobManager = require '../'
|
2 |
|
3 | describe 'RedisPooledJobManager', ->
|
4 | describe 'when instantiated without a jobLogIndexPrefix', ->
|
5 | it 'should throw an exception', ->
|
6 | expect(=> new RedisPooledJobManager).to.throw 'RedisPooledJobManager: jobLogIndexPrefix is required'
|
7 |
|
8 | describe 'when instantiated without a jobLogQueue', ->
|
9 | it 'should throw an exception', ->
|
10 | options =
|
11 | jobLogIndexPrefix: 'meshblu'
|
12 |
|
13 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: jobLogQueue is required'
|
14 |
|
15 | describe 'when instantiated without a jobLogRedisUri', ->
|
16 | it 'should throw an exception', ->
|
17 | options =
|
18 | jobLogIndexPrefix: 'meshblu'
|
19 | jobLogQueue: 'this-queue'
|
20 |
|
21 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: jobLogRedisUri is required'
|
22 |
|
23 | describe 'when instantiated without a jobLogSampleRate', ->
|
24 | it 'should throw an exception', ->
|
25 | options =
|
26 | jobLogIndexPrefix: 'meshblu'
|
27 | jobLogQueue: 'this-queue'
|
28 | jobLogRedisUri: 'redis://localhost:6379'
|
29 |
|
30 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: jobLogSampleRate is required'
|
31 |
|
32 | describe 'when instantiated without a jobLogType', ->
|
33 | it 'should throw an exception', ->
|
34 | options =
|
35 | jobLogIndexPrefix: 'meshblu'
|
36 | jobLogQueue: 'this-queue'
|
37 | jobLogRedisUri: 'redis://localhost:6379'
|
38 | jobLogSampleRate: 0
|
39 |
|
40 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: jobLogType is required'
|
41 |
|
42 | describe 'when instantiated without a jobTimeoutSeconds', ->
|
43 | it 'should throw an exception', ->
|
44 | options =
|
45 | jobLogIndexPrefix: 'meshblu'
|
46 | jobLogQueue: 'this-queue'
|
47 | jobLogRedisUri: 'redis://localhost:6379'
|
48 | jobLogSampleRate: 0
|
49 | jobLogType: 'the-type'
|
50 |
|
51 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: jobTimeoutSeconds is required'
|
52 |
|
53 | describe 'when instantiated without a maxConnections', ->
|
54 | it 'should throw an exception', ->
|
55 | options =
|
56 | jobLogIndexPrefix: 'meshblu'
|
57 | jobLogQueue: 'this-queue'
|
58 | jobLogRedisUri: 'redis://localhost:6379'
|
59 | jobLogSampleRate: 0
|
60 | jobLogType: 'the-type'
|
61 | jobTimeoutSeconds: 3
|
62 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: maxConnections is required'
|
63 |
|
64 | describe 'when instantiated without a namespace', ->
|
65 | it 'should throw an exception', ->
|
66 | options =
|
67 | jobLogIndexPrefix: 'meshblu'
|
68 | jobLogQueue: 'this-queue'
|
69 | jobLogRedisUri: 'redis://localhost:6379'
|
70 | jobLogSampleRate: 0
|
71 | jobLogType: 'the-type'
|
72 | jobTimeoutSeconds: 3
|
73 | maxConnections: 1
|
74 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: namespace is required'
|
75 |
|
76 | describe 'when instantiated without a redisUri', ->
|
77 | it 'should throw an exception', ->
|
78 | options =
|
79 | jobLogIndexPrefix: 'meshblu'
|
80 | jobLogQueue: 'this-queue'
|
81 | jobLogRedisUri: 'redis://localhost:6379'
|
82 | jobLogSampleRate: 0
|
83 | jobLogType: 'the-type'
|
84 | jobTimeoutSeconds: 3
|
85 | maxConnections: 1
|
86 | namespace: 'ns'
|
87 | expect(=> new RedisPooledJobManager options).to.throw 'RedisPooledJobManager: redisUri is required'
|
88 |
|
89 | describe 'when instantiated with everything', ->
|
90 | it 'should not throw an exception', ->
|
91 | options =
|
92 | jobLogIndexPrefix: 'meshblu'
|
93 | jobLogQueue: 'this-queue'
|
94 | jobLogRedisUri: 'redis://localhost:6379'
|
95 | jobLogSampleRate: 0
|
96 | jobLogType: 'the-type'
|
97 | jobTimeoutSeconds: 3
|
98 | maxConnections: 1
|
99 | namespace: 'ns'
|
100 | redisUri: 'redis://localhost:6379'
|
101 | new RedisPooledJobManager options
|
102 | expect(=> new RedisPooledJobManager options).not.to.throw()
|