Skip to content

Commit 2a6ed5d

Browse files
author
Robert Jackson
authored
Merge pull request #814 from bertdeblock/throw-when-using-nonexistent-fastboot-service-property
Throw a helpful error when people use `isFastboot` instead of `isFastBoot`
2 parents 211a934 + 406bc3f commit 2a6ed5d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packages/ember-cli-fastboot/addon/services/fastboot.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ const FastBootService = Service.extend({
6969
headers: deprecatingAlias('request.headers', { id: 'fastboot.headers-to-request', until: '0.9.9' }),
7070
isFastBoot: typeof FastBoot !== 'undefined',
7171

72+
isFastboot: computed(function() {
73+
assert(
74+
'The fastboot service does not have an `isFastboot` property. This is likely a typo. Please use `isFastBoot` instead.',
75+
false
76+
);
77+
}),
78+
7279
init() {
7380
this._super(...arguments);
7481

packages/ember-cli-fastboot/tests/unit/services/fastboot-test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ module('Unit | Service | fastboot in the browser', function(hooks) {
1010
assert.equal(service.get('isFastBoot'), false, `it should be false`);
1111
});
1212

13+
test('isFastboot', function(assert) {
14+
let service = this.owner.lookup('service:fastboot');
15+
assert.throws(() => service.isFastboot, `it should throw`);
16+
assert.throws(() => service.get('isFastboot'), `it should throw`);
17+
});
18+
1319
test('request', function(assert) {
1420
let service = this.owner.lookup('service:fastboot');
1521
assert.equal(service.get('request'), null, `it should be null`);
@@ -24,4 +30,4 @@ module('Unit | Service | fastboot in the browser', function(hooks) {
2430
let service = this.owner.lookup('service:fastboot');
2531
assert.equal(service.get('metadata'), null, `it should be null`);
2632
});
27-
});
33+
});

0 commit comments

Comments
 (0)