-
Notifications
You must be signed in to change notification settings - Fork 0
/
expectation-helpers.ts
23 lines (18 loc) · 1.15 KB
/
expectation-helpers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as chai from 'chai';
chai.use(require('chai-shallow-deep-equal'));
import { ActivityDecisionState } from '../../core/context/state-machines/history-event-state-machines/activity-decision-state-machine/activity-decision-states';
import { BaseActivityDecisionStateMachine } from '../../core/context/state-machines/history-event-state-machines/activity-decision-state-machine/activity-decision';
import { HistoryEventStateMachine } from '../../core/context/state-machines/history-event-state-machines/history-event-state-machine';
const expect = chai.expect;
export function expectActivityState(current: ActivityDecisionState, expected: ActivityDecisionState): void {
expect(current)
.to.eq(expected, `Current state ( ${ActivityDecisionState[current]} ) not equal expected ( ${ActivityDecisionState[expected]} )`);
}
export function expectActivityStateMachine(sm: HistoryEventStateMachine<any>,
properties: any,
currentState: any) {
if (properties !== null) {
(<any>expect(sm).to).shallowDeepEqual(properties);
}
expectActivityState(sm.currentState, currentState);
}