summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/useTemplate/useTemplate.reducer.spec.ts
blob: e0f46e13abdef8cbe0dfee181edc5ac15607147f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import {ServiceInstance} from "../../../models/serviceInstance";
import {useTemplateReducer} from "./useTemplate.reducer";
import {CreateServiceInstanceFromTemplate, UseTemplateActions} from "./useTemplate.action";

test('#CREATE_SERVICE_INSTANCE_FROM_TEMPLATE should add new service instance from template to redux ', () => {
  let serviceFromTemplateInstance: ServiceInstance = <any>{
    instanceName: 'templateInstanceName'
  };
  let serviceState = useTemplateReducer(<any>{
    serviceInstance:{}},
    <CreateServiceInstanceFromTemplate> {
    type: UseTemplateActions.CREATE_SERVICE_INSTANCE_FROM_TEMPLATE,
      serviceModelId: 'serviceModelID',
      serviceInstantiationTemplate: serviceFromTemplateInstance,
  })
  expect (serviceState).toBeDefined();
  expect (serviceState.serviceInstance['serviceModelID'].instanceName).toEqual('templateInstanceName');
});