mirror of
https://github.com/element-hq/synapse
synced 2024-09-04 14:50:06 +00:00
Add modelService test. Thin for now but will be expanded upon.
This commit is contained in:
parent
8bcd36377a
commit
b77cce4ec5
1 changed files with 30 additions and 0 deletions
30
syweb/webclient/test/unit/model-service.spec.js
Normal file
30
syweb/webclient/test/unit/model-service.spec.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
describe('ModelService', function() {
|
||||
|
||||
// setup the dependencies
|
||||
beforeEach(function() {
|
||||
// dependencies
|
||||
module('matrixService');
|
||||
|
||||
// tested service
|
||||
module('modelService');
|
||||
});
|
||||
|
||||
it('should be able to get a member in a room', inject(
|
||||
function(modelService) {
|
||||
var roomId = "!wefiohwefuiow:matrix.org";
|
||||
var userId = "@bob:matrix.org";
|
||||
|
||||
modelService.getRoom(roomId).current_room_state.storeStateEvent({
|
||||
type: "m.room.member",
|
||||
id: "fwefw:matrix.org",
|
||||
user_id: userId,
|
||||
state_key: userId,
|
||||
content: {
|
||||
membership: "join"
|
||||
}
|
||||
});
|
||||
|
||||
var user = modelService.getMember(roomId, userId);
|
||||
expect(user.state_key).toEqual(userId);
|
||||
}));
|
||||
});
|
Loading…
Reference in a new issue