10BC0 Make sure that mixins are specific to each new app by daffl · Pull Request #104 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
init: function () {
_.extend(this, {
methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
mixins: mixins,
mixins: mixins(),
services: {},
providers: [],
_setup: false
Expand Down
10 changes: 6 additions & 4 deletions lib/mixins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

module.exports = [
require('./promise'),
require('./event')
];
module.exports = function() {
return [
require('./promise'),
require('./event')
];
};
10 changes: 10 additions & 0 deletions test/application.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,14 @@ describe('Feathers application', function () {
});
});
});

it('mixins are unique to one application', function() {
var app = feathers();
app.mixins.push(function() {});
assert.equal(app.mixins.length, 3);

var otherApp = feathers();
otherApp.mixins.push(function() {});
assert.equal(otherApp.mixins.length, 3);
});
});
0