Alias would remove unnecessary repetitions and less relative paths make changes easier when moving around files. This commit cleans also up some relative paths ('../../../') by using the alias and orders imports. It updates both path alias in tsconfig and module alias in Vue CLI's bundler (vuejs/vue-cli#2398).
23 lines
880 B
TypeScript
23 lines
880 B
TypeScript
import 'mocha';
|
|
import { expect } from 'chai';
|
|
import { EventSubscriptionCollection } from '@/infrastructure/Events/EventSubscriptionCollection';
|
|
import { IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
|
|
|
describe('EventSubscriptionCollection', () => {
|
|
it('unsubscribeAll unsubscribes from all registered subscriptions', () => {
|
|
// arrange
|
|
const sut = new EventSubscriptionCollection();
|
|
const expected = [ 'unsubscribed1', 'unsubscribed2'];
|
|
const actual = new Array<string>();
|
|
const subscriptions: IEventSubscription[] = [
|
|
{ unsubscribe: () => actual.push(expected[0]) },
|
|
{ unsubscribe: () => actual.push(expected[1]) },
|
|
];
|
|
// act
|
|
sut.register(...subscriptions);
|
|
sut.unsubscribeAll();
|
|
// assert
|
|
expect(actual).to.deep.equal(expected);
|
|
});
|
|
});
|