Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import "reflect-metadata";
import expect = require("expect.js");
import {Mock, IMock, Times, It} from "typemoq";
import CassandraStreamFactory from "../../scripts/cassandra/CassandraStreamFactory";
import TimePartitioner from "../../scripts/cassandra/TimePartitioner";
import {ICassandraClient, IQuery} from "../../scripts/cassandra/ICassandraClient";
import * as Rx from "rx";
import {Event} from "../../scripts/streams/Event";
import IDateRetriever from "../../scripts/util/IDateRetriever";
import IEventsFilter from "../../scripts/cassandra/IEventsFilter";
import IEventDeserializer from "../../scripts/streams/IEventDeserializer";
const anyValue = It.isAny();
describe("Cassandra stream factory, given a stream factory", () => {
let client: IMock;
let subject: CassandraStreamFactory;
let timePartitioner: IMock;
let events: Event[];
let dateRetriever: IMock;
let endDate = new Date(600);
beforeEach(() => {
events = [];
dateRetriever = Mock.ofType();
let eventsFilter = Mock.ofType();
timePartitioner = Mock.ofType(TimePartitioner);
let deserializer = Mock.ofType();
objectContainer.setup(o => o.resolve(It.isAny())).returns(() => new MockProjectionDefinition());
viewResolver.setup(v => v.resolve(It.isAny(), It.isAny())).returns(() => BarView);
uriResolver.setup(u => u.resolve(It.isAny())).returns(() => {
it('should unselect app', () => {
appsState.setup(x => x.select(null))
.returns(() => of(null));
let result = false;
appGuard.canActivate().subscribe(value => {
result = value;
});
expect(result).toBeTruthy();
appsState.verify(x => x.select(null), Times.once());
});
});
it('should unset content', () => {
contentsState.setup(x => x.select(null))
.returns(() => of(null));
let result: boolean;
contentGuard.canActivate().subscribe(x => {
result = x;
}).unsubscribe();
expect(result!).toBeTruthy();
contentsState.verify(x => x.select(null), Times.once());
});
});
it('should show notification on load when reload is true', () => {
contributorsState.load(true).subscribe();
expect().nothing();
dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once());
});
});
it('should unset user', () => {
usersState.setup(x => x.select(null))
.returns(() => of(null));
let result: boolean;
userGuard.canActivate().subscribe(x => {
result = x;
}).unsubscribe();
expect(result!).toBeTruthy();
usersState.verify(x => x.select(null), Times.once());
});
});
it('should load languages', () => {
languagesState.setup(x => x.load())
.returns(() => of(null));
let result = false;
languageGuard.canActivate().subscribe(value => {
result = value;
});
expect(result).toBeTruthy();
languagesState.verify(x => x.load(), Times.once());
});
});
h => h.register(
TestCommand.NAME,
It.isAny(),
TestCommandHandler,
TestCommand
),
Times.once()