This repository has been archived by the owner on Jul 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Le Roux Bodenstein
committed
Feb 8, 2016
1 parent
41babfa
commit f8b0cc5
Showing
15 changed files
with
265 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
'use strict'; | ||
|
||
var Resource = require('tentacles/lib/Resource'); | ||
var method = Resource.method; | ||
|
||
module.exports = Resource.extend({ | ||
listForRoom: method({ | ||
method: 'GET', | ||
path: '/v1/rooms/:roomId/channels', | ||
urlParams: ['roomId'] | ||
}), | ||
|
||
listForUser: method({ | ||
method: 'GET', | ||
path: '/v1/user/:userId/channels', | ||
urlParams: ['userId'] | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
var Resource = require('tentacles/lib/Resource'); | ||
var method = Resource.method; | ||
|
||
module.exports = Resource.extend({ | ||
listForUser: method({ | ||
method: 'GET', | ||
path: '/v1/user/:userId/orgs', | ||
urlParams: ['userId'] | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
var Resource = require('tentacles/lib/Resource'); | ||
var method = Resource.method; | ||
|
||
module.exports = Resource.extend({ | ||
listForUser: method({ | ||
method: 'GET', | ||
path: '/v1/user/:userId/repos', | ||
urlParams: ['userId'] | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
var Resource = require('tentacles/lib/Resource'); | ||
var method = Resource.method; | ||
|
||
module.exports = Resource.extend({ | ||
listForUserAndRoom: method({ | ||
method: 'GET', | ||
path: '/v1/user/:userId/rooms/:roomId/unreadItems', | ||
urlParams: ['userId', 'roomId'] | ||
}), | ||
|
||
markForUserAndRoom: method({ | ||
This comment has been minimized.
Sorry, something went wrong. |
||
method: 'POST', | ||
path: '/v1/user/:userId/rooms/:roomId/unreadItems', | ||
urlParams: ['userId', 'roomId'] | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var testUtils = require('../utils'); | ||
|
||
describe('channels', function() { | ||
var client; | ||
var userId; | ||
var roomId; | ||
|
||
before(function() { | ||
assert(process.env.GITTER_ACCESS_TOKEN, 'Please set GITTER_ACCESS_TOKEN'); | ||
return testUtils.setup() | ||
.spread(function(_client, _userId, _roomId) { | ||
client = _client | ||
userId = _userId; | ||
roomId = _roomId; | ||
}); | ||
}); | ||
|
||
it("it lists a user's channels", function() { | ||
return client.channels.listForUser(userId) | ||
.then(function(channels) { | ||
assert(Array.isArray(channels)); | ||
}); | ||
}); | ||
|
||
it('it lists the channels in a room', function() { | ||
return client.channels.listForRoom(roomId) | ||
.then(function(channels) { | ||
assert(Array.isArray(channels)); | ||
}); | ||
}); | ||
|
||
}); |
22 changes: 8 additions & 14 deletions
22
test/resources/messages.js → test/resources/messages-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var testUtils = require('../utils'); | ||
|
||
describe('orgs', function() { | ||
var client; | ||
var userId; | ||
var roomId; | ||
|
||
before(function() { | ||
assert(process.env.GITTER_ACCESS_TOKEN, 'Please set GITTER_ACCESS_TOKEN'); | ||
return testUtils.setup() | ||
.spread(function(_client, _userId, _roomId) { | ||
client = _client; | ||
userId = _userId; | ||
roomId = _roomId; | ||
}); | ||
}); | ||
|
||
it("should list a user's orgs", function() { | ||
return client.orgs.listForUser(userId) | ||
.then(function(orgs) { | ||
assert(Array.isArray(orgs)); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var testUtils = require('../utils'); | ||
|
||
describe('repos', function() { | ||
var client; | ||
var userId; | ||
var roomId; | ||
|
||
before(function() { | ||
assert(process.env.GITTER_ACCESS_TOKEN, 'Please set GITTER_ACCESS_TOKEN'); | ||
return testUtils.setup() | ||
.spread(function(_client, _userId, _roomId) { | ||
client = _client; | ||
userId = _userId; | ||
roomId = _roomId; | ||
}); | ||
}); | ||
|
||
it("should list a user's repos", function() { | ||
return client.repos.listForUser(userId) | ||
.then(function(repos) { | ||
assert(Array.isArray(repos)); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var testUtils = require('../utils'); | ||
|
||
describe('unreads', function() { | ||
var client; | ||
var userId; | ||
var roomId; | ||
|
||
before(function() { | ||
assert(process.env.GITTER_ACCESS_TOKEN, 'Please set GITTER_ACCESS_TOKEN'); | ||
return testUtils.setup() | ||
.spread(function(_client, _userId, _roomId) { | ||
client = _client; | ||
userId = _userId; | ||
roomId = _roomId; | ||
}); | ||
}); | ||
|
||
it("should list a user's unreads for a room", function() { | ||
return client.unreads.listForUserAndRoom(userId, roomId) | ||
.then(function(result) { | ||
assert(Array.isArray(result.chat)); | ||
assert(Array.isArray(result.mention)); | ||
}); | ||
}); | ||
|
||
it("should mark a user's unreads for a room", function() { | ||
return client.unreads.markForUserAndRoom(userId, roomId, {chat: ['foo']}) | ||
.then(function(result) { | ||
assert.equal(result.success, true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
var assert = require('assert'); | ||
var testUtils = require('../utils'); | ||
|
||
describe('users', function() { | ||
var client; | ||
var userId; | ||
var roomId; | ||
|
||
before(function() { | ||
assert(process.env.GITTER_ACCESS_TOKEN, 'Please set GITTER_ACCESS_TOKEN'); | ||
return testUtils.setup() | ||
.spread(function(_client, _userId, _roomId) { | ||
client = _client; | ||
userId = _userId; | ||
roomId = _roomId; | ||
}); | ||
}); | ||
|
||
it('should get the authenticated user', function() { | ||
return client.users.getAuthUser() | ||
.then(function(user) { | ||
assert(user.username); | ||
}) | ||
}); | ||
|
||
it('should list the users in a room', function() { | ||
return client.users.listForRoom(roomId) | ||
.then(function(users) { | ||
assert(Array.isArray(users)); | ||
}) | ||
}); | ||
}); |
Oops, something went wrong.
markItemsRead
?