3 var fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
4 var assert = require('assert');
5 var roomRepoService = require('../lib/room-repo-service');
7 describe('room-repo-service #slow', function() {
8 var fixture = fixtureLoader.setup({
18 admins: 'GH_REPO_PUSH',
25 admins: 'GH_REPO_PUSH',
32 admins: 'GH_REPO_PUSH',
43 describe('findAssociatedGithubObjectForRoom', function() {
44 it('should deal with rooms with no backing object', function() {
45 return roomRepoService
46 .findAssociatedGithubObjectForRoom(fixture.troupe1)
47 .then(function(result) {
48 assert.deepEqual(result, null);
52 it('should deal with groups with no backing object', function() {
53 return roomRepoService
54 .findAssociatedGithubObjectForRoom(fixture.troupe7)
55 .then(function(result) {
56 assert.deepEqual(result, null);
60 it('should deal with rooms backed by a repo', function() {
61 return roomRepoService
62 .findAssociatedGithubObjectForRoom(fixture.troupe5)
63 .then(function(result) {
64 assert.deepEqual(result, {
70 it('should deal with groups backed by a repo', function() {
71 return roomRepoService
72 .findAssociatedGithubObjectForRoom(fixture.troupe4)
73 .then(function(result) {
74 assert.deepEqual(result, {
82 describe('findAssociatedGithubRepoForRooms', function() {
83 it('should deal with no rooms', function() {
84 return roomRepoService.findAssociatedGithubRepoForRooms([]).then(function(result) {
85 assert.deepEqual(result, {});
89 it('should deal with one room, not successful', function() {
90 return roomRepoService
91 .findAssociatedGithubRepoForRooms([fixture.troupe1])
92 .then(function(result) {
93 assert.deepEqual(result, {});
97 it('should deal with one room, successful', function() {
98 return roomRepoService
99 .findAssociatedGithubRepoForRooms([fixture.troupe4])
100 .then(function(result) {
102 expected[fixture.troupe4.id] = 'x/y';
103 assert.deepEqual(result, expected);
107 it('should deal with many rooms', function() {
108 return roomRepoService
109 .findAssociatedGithubRepoForRooms([fixture.troupe1, fixture.troupe2, fixture.troupe3])
110 .then(function(result) {
111 assert.deepEqual(result, {});
115 it('should deal with mixed rooms', function() {
116 return roomRepoService
117 .findAssociatedGithubRepoForRooms([fixture.troupe1, fixture.troupe4])
118 .then(function(result) {
120 expected[fixture.troupe4.id] = 'x/y';
121 assert.deepEqual(result, expected);
125 it('should deal with mixed rooms, 2', function() {
126 return roomRepoService
127 .findAssociatedGithubRepoForRooms([
133 .then(function(result) {
135 expected[fixture.troupe4.id] = 'x/y';
136 expected[fixture.troupe5.id] = '1/2';
137 expected[fixture.troupe6.id] = '3/4';
138 assert.deepEqual(result, expected);