Merge branch 'hotfix/21.56.9' into master
[gitter.git] / modules / rooms / test / uri-resolver-test.js
bloba90c0ff13f36ac1b7b441c5b072467a6d80d48ad
1 'use strict';
3 var assert = require('assert');
4 var fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
5 var uriResolver = require('../lib/uri-resolver');
7 describe('uri-resolver', function() {
8   var fixture = fixtureLoader.setup({
9     user1: {},
10     group1: {},
11     troupe1: { group: 'group1', security: 'PUBLIC' }
12   });
14   describe('uriResolver', () => {
15     it('should resolve user', () => {
16       return uriResolver(fixture.user1.get('id'), fixture.user1.get('username')).then(function(
17         result
18       ) {
19         assert.strictEqual(result.user.username, fixture.user1.get('username'));
20       });
21     });
23     it('should resolve room', () => {
24       return uriResolver(fixture.user1.get('id'), fixture.troupe1.get('uri')).then(function(
25         result
26       ) {
27         assert.strictEqual(result.room.uri, fixture.troupe1.get('uri'));
28       });
29     });
31     it('should resolve group', () => {
32       return uriResolver(fixture.user1.get('id'), fixture.group1.get('uri')).then(function(result) {
33         assert.strictEqual(result.group.uri, fixture.group1.get('uri'));
34       });
35     });
36   });
37 });