summary refs log tree commit diff
path: root/syweb/webclient/test/unit/model-service.spec.js
blob: 2e012efe90a96244997ad04fb6cb068d74ea1178 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
    }));
});