auth.action.spec.ts 1.71 KB
Newer Older
1
2
3
import * as authActions from './auth.action';

describe('[Auth] Action', () => {
Tifenn Guillas's avatar
Tifenn Guillas committed
4
5
6
7
8
9
10
11
12
13
14
    it('should create CheckAuthAction', () => {
        const action = new authActions.CheckAuthAction();
        expect(action.type).toEqual(authActions.CHECK_AUTH);
    });

    it('should create CheckAuthCompleteAction', () => {
        const action = new authActions.CheckAuthCompleteAction(true);
        expect(action.type).toEqual(authActions.CHECK_AUTH_COMPLETE);
        expect(action.payload).toBeTruthy();
    });

15
16
17
18
19
    it('should create LoginAction', () => {
        const action = new authActions.LoginAction();
        expect(action.type).toEqual(authActions.LOGIN);
    });

Tifenn Guillas's avatar
Tifenn Guillas committed
20
21
22
23
24
25
    it('should create LoginCompleteAction', () => {
        const action = new authActions.LoginCompleteAction('toto');
        expect(action.type).toEqual(authActions.LOGIN_COMPLETE);
        expect(action.payload).toEqual('toto');
    });

26
27
28
29
    it('should create LogoutAction', () => {
        const action = new authActions.LogoutAction();
        expect(action.type).toEqual(authActions.LOGOUT);
    });
Tifenn Guillas's avatar
Tifenn Guillas committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

    it('should create OpenEditProfileAction', () => {
        const action = new authActions.OpenEditProfileAction();
        expect(action.type).toEqual(authActions.OPEN_EDIT_PROFILE);
    });

    it('should create ParseJwtAction', () => {
        const action = new authActions.ParseJwtAction('toto');
        expect(action.type).toEqual(authActions.PARSE_JWT);
        expect(action.payload).toEqual('toto');
    });

    it('should create LoadUserRolesAction', () => {
        const action = new authActions.LoadUserRolesAction(['toto']);
        expect(action.type).toEqual(authActions.LOAD_USER_ROLES);
        expect(action.payload).toEqual(['toto']);
    });
47
});