1 /*jslint node:true, unused:true*/
2 /*global describe:true, it:true */
5 var assert = require('assert');
6 var fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
8 var troupeUriMapper = require('../lib/troupe-uri-mapper');
10 describe('troupe-uri-mapper', function() {
11 describe('#findInitialRoomUrlForUser', function() {
12 var fixture = fixtureLoader.setup({
16 troupe1: { users: ['user1'] },
17 troupeOneToOne: { oneToOne: true, users: ['user1', 'user2'] }
20 it('#01 should return null when a user has no troupes', function() {
21 return troupeUriMapper
22 .getUrlOfFirstAccessibleRoom([fixture.userNoTroupes.id], fixture.user1.id)
28 it('#02 should return the first room that allows access', function() {
29 return troupeUriMapper
30 .getUrlOfFirstAccessibleRoom(
31 [fixture.userNoTroupes.id, fixture.troupe1.id],
35 assert.strictEqual(url, '/' + fixture.troupe1.uri);
39 it('#03 should return the one to one rooms', function() {
40 return troupeUriMapper
41 .getUrlOfFirstAccessibleRoom(
42 [fixture.userNoTroupes.id, fixture.troupeOneToOne.id, fixture.troupe1.id],
46 assert.strictEqual(url, '/' + fixture.user2.username);
50 it('#04 should return the other user in a one-to-one room', function() {
51 return troupeUriMapper
52 .getUrlOfFirstAccessibleRoom(
53 [fixture.userNoTroupes.id, fixture.troupeOneToOne.id],
57 assert.strictEqual(url, '/' + fixture.user1.username);