summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.action.spec.ts
blob: a65249a3be5468b92e428dee0c9bda06a19dd6a1 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import {
  GeneralActions, UpdateAicZonesAction,
  UpdateLcpRegionsAndTenantsAction,
  UpdateProductFamiliesAction,
  UpdateSubscribersAction, UpdateUserIdAction
} from "./general.actions";
import {SelectOption} from "../../../models/selectOption";


describe('general actions', () => {
  test('#UPDATE_LCP_REGIONS_AND_TENANTS : action', () => {
    const action: UpdateLcpRegionsAndTenantsAction = <UpdateLcpRegionsAndTenantsAction>{
      type: GeneralActions.UPDATE_LCP_REGIONS_AND_TENANTS,
      lcpRegionsAndTenants: {
        "lcpRegionList": [],
        "lcpRegionsTenantsMap": {}
      }
    };

    expect(action.type).toEqual(GeneralActions.UPDATE_LCP_REGIONS_AND_TENANTS);
    expect(action.lcpRegionsAndTenants.lcpRegionList).toEqual([]);
    expect(action.lcpRegionsAndTenants.lcpRegionsTenantsMap).toEqual({});
  });

  test('#UPDATE_SUBSCRIBERS : action', () => {
    const action: UpdateSubscribersAction = <UpdateSubscribersAction>{
      type: GeneralActions.UPDATE_SUBSCRIBERS,
      subscribers: [
        {
          "id": "ERICA5779-Subscriber-2",
          "name": "ERICA5779-Subscriber-2",
          "isPermitted": false
        },
        {
          "id": "ERICA5779-Subscriber-3",
          "name": "ERICA5779-Subscriber-3",
          "isPermitted": false
        },
        {
          "id": "ERICA5779-Subscriber-4",
          "name": "ERICA5779-Subscriber-5",
          "isPermitted": false
        },
        {
          "id": "ERICA5779-TestSub-PWT-101",
          "name": "ERICA5779-TestSub-PWT-101",
          "isPermitted": false
        },
        {
          "id": "ERICA5779-TestSub-PWT-102",
          "name": "ERICA5779-TestSub-PWT-102",
          "isPermitted": false
        },
        {
          "id": "ERICA5779-TestSub-PWT-103",
          "name": "ERICA5779-TestSub-PWT-103",
          "isPermitted": false
        },
        {
          "id": "31739f3e-526b-11e6-beb8-9e71128cae77",
          "name": "CRAIG/ROBERTS",
          "isPermitted": false
        },
        {
          "id": "DHV1707-TestSubscriber-2",
          "name": "DALE BRIDGES",
          "isPermitted": false
        },
        {
          "id": "jimmy-example",
          "name": "JimmyExampleCust-20161102",
          "isPermitted": false
        },
        {
          "id": "jimmy-example2",
          "name": "JimmyExampleCust-20161103",
          "isPermitted": false
        },
        {
          "id": "CAR_2020_ER",
          "name": "CAR_2020_ER",
          "isPermitted": true
        },
        {
          "id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
          "name": "Emanuel",
          "isPermitted": false
        },
        {
          "id": "21014aa2-526b-11e6-beb8-9e71128cae77",
          "name": "JULIO ERICKSON",
          "isPermitted": false
        },
        {
          "id": "DHV1707-TestSubscriber-1",
          "name": "LLOYD BRIDGES",
          "isPermitted": false
        },
        {
          "id": "e433710f-9217-458d-a79d-1c7aff376d89",
          "name": "SILVIA ROBBINS",
          "isPermitted": true
        }
      ]
    };

    expect(action.type).toEqual(GeneralActions.UPDATE_SUBSCRIBERS);
    expect(action.subscribers).toHaveLength(15);
  });

  test('#UPDATE_PRODUCT_FAMILIES : action', () => {
    const action: UpdateProductFamiliesAction = <UpdateProductFamiliesAction>{
      type: GeneralActions.UPDATE_PRODUCT_FAMILIES,
      productFamilies: [
        new SelectOption({
          id : 'id',
          name : 'name',
          isPermitted : false
        })
      ]
    };

    expect(action.type).toEqual(GeneralActions.UPDATE_PRODUCT_FAMILIES);
    expect(action.productFamilies).toHaveLength(1);
  });


  test('#UpdateAicZonesAction : action', () => {
    const action: UpdateAicZonesAction = <UpdateAicZonesAction>{
      type: GeneralActions.UPDATE_AIC_ZONES,
      aicZones: [
        new SelectOption({
          id : 'id',
          name : 'name',
          isPermitted : false
        })
      ]
    };

    expect(action.type).toEqual(GeneralActions.UPDATE_AIC_ZONES);
    expect(action.aicZones).toHaveLength(1);
  });

  test('#UpdateUserIdAction : action', () => {
    const action: UpdateUserIdAction = <UpdateUserIdAction>{
      type: GeneralActions.UPDATE_USER_ID,
      userId: "userId"
    };

    expect(action.type).toEqual(GeneralActions.UPDATE_USER_ID);
    expect(action.userId).toBe("userId");
  });

});