Skip to content

Commit 70eaea5

Browse files
author
Aschen
committed
Allow to not inherit from BaseController
1 parent 0b035a1 commit 70eaea5

File tree

7 files changed

+5
-15
lines changed

7 files changed

+5
-15
lines changed

src/Kuzzle.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,6 @@ Discarded request: ${JSON.stringify(request)}`));
516516
* @returns {Kuzzle}
517517
*/
518518
useController (ControllerClass, accessor) {
519-
if (!(ControllerClass.prototype.__proto__.constructor.name === 'BaseController')) {
520-
throw new Error('Controllers must inherits from the BaseController class.');
521-
}
522-
523519
if (!(accessor && accessor.length > 0)) {
524520
throw new Error('You must provide a valid accessor.');
525521
}

test/controllers/searchResult/document.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('DocumentSearchResult', () => {
106106
};
107107

108108
beforeEach(() => {
109-
request.scroll = '1m';
109+
request.scroll = '10s';
110110

111111
response = {
112112
scrollId: 'scroll-id',

test/controllers/searchResult/profile.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe('ProfileSearchResult', () => {
110110
};
111111

112112
beforeEach(() => {
113-
request.scroll = '1m';
113+
request.scroll = '10s';
114114

115115
response = {
116116
scrollId: 'scroll-id',

test/controllers/searchResult/role.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('RoleSearchResult', () => {
8484

8585

8686
it('should throw an error if scrollId parameters is set', () => {
87-
request.scroll = '1m';
87+
request.scroll = '10s';
8888
searchResult = new RoleSearchResult(kuzzle, request, options, response);
8989

9090
should(function () {

test/controllers/searchResult/specifications.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('SpecificationsSearchResult', () => {
100100
};
101101

102102
beforeEach(() => {
103-
request.scroll = '1m';
103+
request.scroll = '10s';
104104

105105
response = {
106106
scrollId: 'scroll-id',

test/controllers/searchResult/user.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('UserSearchResult', () => {
112112
};
113113

114114
beforeEach(() => {
115-
request.scroll = '1m';
115+
request.scroll = '10s';
116116

117117
response = {
118118
scrollId: 'scroll-id',

test/kuzzle/useController.test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@ describe('Kuzzle custom controllers management', () => {
8282
});
8383
});
8484

85-
it('should throw if the controller does not inherits from BaseController', () => {
86-
should(() => {
87-
kuzzle.useController(NotInheritingController, 'wrong');
88-
}).throw('Controllers must inherits from the BaseController class.');
89-
});
90-
9185
it('should throw if the controller does not have a name', () => {
9286
should(() => {
9387
kuzzle.useController(UnamedController, 'unamed');

0 commit comments

Comments
 (0)