Skip to content

Commit 643eed8

Browse files
committed
Add tests for deploy without activation message, and activation message
1 parent 3b19f95 commit 643eed8

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ module.exports = {
112112
this.log('preparing to activate `' + revisionKey + '`', { verbose: true });
113113

114114
var s3 = new this.S3({ plugin: this });
115-
return s3.activate(options).then(function() {
115+
return s3.activate(options).then(() => {
116+
this.log(`✔ Activated revision \`${revisionKey}\``, {});
117+
116118
return {
117119
revisionData: {
118120
activatedRevisionKey: revisionKey

tests/unit/index-test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe('s3-index plugin', function() {
6161
});
6262

6363
context = {
64+
deployTarget: "qa",
6465
ui: mockUi,
6566

6667
project: stubProject,
@@ -262,6 +263,15 @@ describe('s3-index plugin', function() {
262263
assert.equal(Object.prototype.hasOwnProperty.call(s3Options, 'serverSideEncryption'), false, 'serverSideEncryption filtered correctly');
263264
});
264265
});
266+
267+
it('displays activation message when revision is activated', function() {
268+
var promise = plugin.activate(context);
269+
270+
return assert.isFulfilled(promise)
271+
.then(function() {
272+
assert.match(mockUi.messages.join("\n"), new RegExp(`✔ Activated revision \`${REVISION_KEY}\``));
273+
});
274+
})
265275
});
266276

267277
describe('#fetchInitialRevisions', function() {
@@ -315,5 +325,21 @@ describe('s3-index plugin', function() {
315325
});
316326
});
317327
});
328+
329+
describe('#didDeploy', function() {
330+
it("prints default message about lack of activation when revision has not been activated", function() {
331+
plugin.upload = function() {};
332+
plugin.activate = function() {};
333+
plugin.beforeHook(context);
334+
plugin.configure(context);
335+
plugin.beforeHook(context);
336+
plugin.didDeploy(context);
337+
338+
let message = mockUi.messages.join("\n")
339+
assert.match(message, new RegExp(`Deployed but did not activate revision ${REVISION_KEY}`));
340+
assert.match(message, /To activate, run/);
341+
assert.match(message, new RegExp(`ember deploy:activate qa --revision=${REVISION_KEY}`));
342+
});
343+
});
318344
});
319345
});

0 commit comments

Comments
 (0)