Skip to content

Commit db29dda

Browse files
author
James Hiscock
committed
Update tests for activationSuffix
1 parent a946f34 commit db29dda

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

tests/unit/index-nodetest.js

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,14 @@ describe('redis plugin', function() {
199199

200200
return previous;
201201
}, []);
202-
assert.equal(messages.length, 8);
202+
assert.equal(messages.length, 9);
203203
});
204204
it('adds default config to the config object', function() {
205205
plugin.configure(context);
206206
assert.isDefined(config.redis.host);
207207
assert.isDefined(config.redis.port);
208208
assert.isDefined(config.redis.keyPrefix);
209+
assert.isDefined(config.redis.activationSuffix);
209210
assert.isDefined(config.redis.didDeployMessage);
210211
});
211212
});
@@ -228,7 +229,7 @@ describe('redis plugin', function() {
228229
};
229230
plugin.beforeHook(context);
230231
});
231-
it('warns about missing optional filePattern, distDir, revisionKey, didDeployMessage, and connection info', function() {
232+
it('warns about missing optional filePattern, distDir, activationSuffix, revisionKey, didDeployMessage, and connection info', function() {
232233
plugin.configure(context);
233234
var messages = mockUi.messages.reduce(function(previous, current) {
234235
if (/- Missing config:\s.*, using default:\s/.test(current)) {
@@ -237,18 +238,59 @@ describe('redis plugin', function() {
237238

238239
return previous;
239240
}, []);
240-
assert.equal(messages.length, 7);
241+
assert.equal(messages.length, 8);
241242
});
242243
it('does not add default config to the config object', function() {
243244
plugin.configure(context);
244245
assert.isDefined(config.redis.host);
245246
assert.isDefined(config.redis.port);
246247
assert.isDefined(config.redis.filePattern);
248+
assert.isDefined(config.redis.activationSuffix);
247249
assert.isDefined(config.redis.didDeployMessage);
248250
assert.equal(config.redis.keyPrefix, 'proj:home');
249251
});
250252
});
251253

254+
describe('with an activationSuffix provided', function () {
255+
var config, plugin, context;
256+
beforeEach(function() {
257+
config = {
258+
redis: {
259+
activationSuffix: 'special:suffix'
260+
}
261+
};
262+
plugin = subject.createDeployPlugin({
263+
name: 'redis'
264+
});
265+
context = {
266+
ui: mockUi,
267+
project: stubProject,
268+
config: config
269+
};
270+
plugin.beforeHook(context);
271+
});
272+
it('warns about missing optional filePattern, distDir, keyPrefix, revisionKey, didDeployMessage, and connection info', function() {
273+
plugin.configure(context);
274+
var messages = mockUi.messages.reduce(function(previous, current) {
275+
if (/- Missing config:\s.*, using default:\s/.test(current)) {
276+
previous.push(current);
277+
}
278+
279+
return previous;
280+
}, []);
281+
assert.equal(messages.length, 8)
282+
});
283+
it('does not add default config to the config object', function() {
284+
plugin.configure(context);
285+
assert.isDefined(config.redis.host);
286+
assert.isDefined(config.redis.port);
287+
assert.isDefined(config.redis.filePattern);
288+
assert.isDefined(config.redis.keyPrefix);
289+
assert.isDefined(config.redis.didDeployMessage);
290+
assert.equal(config.redis.activationSuffix, 'special:suffix');
291+
});
292+
});
293+
252294
describe('with a url provided', function () {
253295
var config, plugin, context;
254296
beforeEach(function() {
@@ -267,7 +309,7 @@ describe('redis plugin', function() {
267309
};
268310
plugin.beforeHook(context);
269311
});
270-
it('warns about missing optional filePattern, distDir, keyPrefix, revisionKey and didDeployMessage only', function() {
312+
it('warns about missing optional filePattern, distDir, keyPrefix, activationSuffix, revisionKey, and didDeployMessage only', function() {
271313
plugin.configure(context);
272314
var messages = mockUi.messages.reduce(function(previous, current) {
273315
if (/- Missing config:\s.*, using default:\s/.test(current)) {
@@ -276,7 +318,7 @@ describe('redis plugin', function() {
276318

277319
return previous;
278320
}, []);
279-
assert.equal(messages.length, 6);
321+
assert.equal(messages.length, 7);
280322
});
281323

282324
it('does not add default config to the config object', function() {

tests/unit/lib/redis-nodetest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('redis', function() {
200200

201201
redis._client.recentRevisions = ['a', 'b', 'c'];
202202

203-
var promise = redis.activate('key-prefix', 'c');
203+
var promise = redis.activate('key-prefix', 'c', 'current');
204204
return assert.isFulfilled(promise)
205205
.then(function() {
206206
assert.equal(redisKey, 'key-prefix:current');

0 commit comments

Comments
 (0)