Skip to content

Commit c67bb8c

Browse files
committed
passed scopes to mapper for #8
1 parent 68c5678 commit c67bb8c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/api/users/controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function getList(scopes, callback) {
99
if (err) {
1010
callback(err);
1111
} else {
12-
callback(null, { users: mapper.mapListToView(list, 32) });
12+
callback(null, { users: mapper.mapListToView(list, 32, scopes) });
1313
}
1414
});
1515
}

test/unit/api/users/controller-test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ var path = require('path'),
99

1010
suite('users controller', function () {
1111
var viewList = ['view-foo', 'view-bar'],
12+
scopes = any.listOf(any.string),
1213
error = any.string();
1314

1415
setup(function () {
1516
var list = ['foo', 'bar'];
1617

1718
sinon.stub(repo, 'getList').yields(null, list);
18-
sinon.stub(mapper, 'mapListToView').withArgs(list, 32).returns(viewList);
19+
sinon.stub(mapper, 'mapListToView').withArgs(list, 32, scopes).returns(viewList);
1920

2021
sinon.stub(repo, 'getUser');
2122
sinon.stub(mapper, 'mapToView');
@@ -32,7 +33,7 @@ suite('users controller', function () {
3233
test('that list is returned from repository', function () {
3334
var callback = sinon.spy();
3435

35-
controller.getList(undefined, callback);
36+
controller.getList(scopes, callback);
3637

3738
assert.calledWith(callback, null, { users: viewList });
3839
});

0 commit comments

Comments
 (0)