Skip to content

Commit cb8bf0e

Browse files
author
Robert Jackson
committed
Remove ember-source from devDependencies.
We were using it primarily to test that our `FastBootHeaders.prototype.unknownProperty` method functioned properly. This refactors things to use a simulated `Ember.get` to allow the same test scenario to succeeed, but avoid having to depend on Ember itself. Note: this does not remove any "real" testing of various Ember versions, most of our tests are using fixtures with a fully compiled ember-cli applications.
1 parent 85a3666 commit cb8bf0e

3 files changed

Lines changed: 32 additions & 1506 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"devDependencies": {
3737
"chai": "^4.2.0",
3838
"chai-as-promised": "^7.1.1",
39-
"ember-source": "3.8.0",
4039
"eslint": "^6.5.1",
4140
"eslint-config-prettier": "^6.4.0",
4241
"eslint-plugin-chai-expect": "^2.0.1",

test/fastboot-headers-test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
var expect = require('chai').expect;
44
var FastBootHeaders = require('./../src/fastboot-headers.js');
5-
var Ember = require('ember-source/dist/ember.debug');
65

76
describe('FastBootHeaders', function() {
87
it('lower normalizes the headers to lowercase', function() {
@@ -161,6 +160,19 @@ describe('FastBootHeaders', function() {
161160
'x-test-header': ['value1', 'value2'],
162161
};
163162
headers = new FastBootHeaders(headers);
164-
expect(Ember.get(headers, 'x-test-header')).to.eq(headers.get('x-test-header'));
163+
164+
function fakeEmberGet(object, path) {
165+
if (path in object) {
166+
return object[path];
167+
}
168+
169+
if ('unknownProperty' in object) {
170+
return object.unknownProperty(path);
171+
}
172+
173+
return undefined;
174+
}
175+
176+
expect(fakeEmberGet(headers, 'x-test-header')).to.eq(headers.get('x-test-header'));
165177
});
166178
});

0 commit comments

Comments
 (0)