3 var proxyquireNoCallThru = require('proxyquire').noCallThru();
4 var fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
5 var assert = require('assert');
6 var Promise = require('bluebird');
8 describe('group-resolver', function() {
9 describe('#slow', function() {
13 var fixture = fixtureLoader.setup({
15 troupe1: { users: ['user1'] }
18 beforeEach(function() {
19 var createPolicyForRoom = function() {
20 return Promise.resolve({
21 canAdmin: function() {
22 return Promise.resolve(adminPermission);
27 groupResolver = proxyquireNoCallThru('../lib/group-resolver', {
28 'gitter-web-permissions/lib/policy-factory': {
29 createPolicyForRoom: createPolicyForRoom
34 it('should resolve @/all mentions for admins', function() {
35 var troupe = fixture.troupe1;
36 var user1 = fixture.user1;
37 adminPermission = true;
39 return groupResolver(troupe, user1, ['all']).then(function(result) {
40 assert.strictEqual(result.all.announcement, true);
44 it('should resolve not resolve mentions for non-admins', function() {
45 var troupe = fixture.troupe1;
46 var user1 = fixture.user1;
47 adminPermission = false;
49 return groupResolver(troupe, user1, ['all']).then(function(result) {