build: add bazel test rules for remainder of packages (#21053)
PR Close #21053
This commit is contained in:
@ -34,9 +34,10 @@ import {createPairedMessageBuses} from './web_worker_test_util';
|
||||
});
|
||||
it('should call registered method with correct arguments',
|
||||
inject([Serializer], (serializer: Serializer) => {
|
||||
const broker = new ServiceMessageBroker(messageBuses.ui, serializer, CHANNEL);
|
||||
const broker = new (ServiceMessageBroker as any)(messageBuses.ui, serializer, CHANNEL);
|
||||
broker.registerMethod(
|
||||
TEST_METHOD, [SerializerTypes.PRIMITIVE, SerializerTypes.PRIMITIVE], (arg1, arg2) => {
|
||||
TEST_METHOD, [SerializerTypes.PRIMITIVE, SerializerTypes.PRIMITIVE],
|
||||
(arg1: any, arg2: any) => {
|
||||
expect(arg1).toEqual(PASSED_ARG_1);
|
||||
expect(arg2).toEqual(PASSED_ARG_2);
|
||||
});
|
||||
@ -47,8 +48,8 @@ import {createPairedMessageBuses} from './web_worker_test_util';
|
||||
}));
|
||||
|
||||
it('should return promises to the worker', inject([Serializer], (serializer: Serializer) => {
|
||||
const broker = new ServiceMessageBroker(messageBuses.ui, serializer, CHANNEL);
|
||||
broker.registerMethod(TEST_METHOD, [SerializerTypes.PRIMITIVE], (arg1) => {
|
||||
const broker = new (ServiceMessageBroker as any)(messageBuses.ui, serializer, CHANNEL);
|
||||
broker.registerMethod(TEST_METHOD, [SerializerTypes.PRIMITIVE], (arg1: any) => {
|
||||
expect(arg1).toEqual(PASSED_ARG_1);
|
||||
return new Promise((res, rej) => {
|
||||
try {
|
||||
|
@ -130,7 +130,9 @@ export class MockMessageBus extends MessageBus {
|
||||
attachToZone(zone: NgZone) {}
|
||||
}
|
||||
|
||||
export class MockMessageBrokerFactory extends ClientMessageBrokerFactory {
|
||||
export const _ClientMessageBrokerFactory: {new (a: any, b: any): ClientMessageBrokerFactory} =
|
||||
ClientMessageBrokerFactory;
|
||||
export class MockMessageBrokerFactory extends _ClientMessageBrokerFactory {
|
||||
constructor(private _messageBroker: ClientMessageBroker) { super(null !, null !); }
|
||||
createMessageBroker(channel: string, runInZone = true) { return this._messageBroker; }
|
||||
}
|
||||
|
@ -67,18 +67,18 @@ import {SpyMessageBroker} from './spies';
|
||||
it('should get location on init', () => {
|
||||
const platformLocation = createWebWorkerPlatformLocation(null !);
|
||||
expectBrokerCall(broker, 'getLocation');
|
||||
platformLocation.init();
|
||||
(platformLocation as any).init();
|
||||
});
|
||||
|
||||
it('should throw if set pathname is called before init finishes', () => {
|
||||
const platformLocation = createWebWorkerPlatformLocation(null !);
|
||||
platformLocation.init();
|
||||
(platformLocation as any).init();
|
||||
expect(() => platformLocation.pathname = 'TEST').toThrowError();
|
||||
});
|
||||
|
||||
it('should send pathname to render thread', done => {
|
||||
const platformLocation = createWebWorkerPlatformLocation(TEST_LOCATION);
|
||||
platformLocation.init().then((_) => {
|
||||
(platformLocation as any).init().then((_: any) => {
|
||||
const PATHNAME = '/test';
|
||||
expectBrokerCall(broker, 'setPathname', [PATHNAME]);
|
||||
platformLocation.pathname = PATHNAME;
|
||||
|
@ -184,10 +184,10 @@ function createWebWorkerBrokerFactory(
|
||||
const wwMessageBus = messageBuses.worker;
|
||||
|
||||
// set up the worker side
|
||||
const wwBrokerFactory = new ClientMessageBrokerFactory(wwMessageBus, wwSerializer);
|
||||
const wwBrokerFactory = new (ClientMessageBrokerFactory as any)(wwMessageBus, wwSerializer);
|
||||
|
||||
// set up the ui side
|
||||
const uiBrokerFactory = new ServiceMessageBrokerFactory(uiMessageBus, uiSerializer);
|
||||
const uiBrokerFactory = new (ServiceMessageBrokerFactory as any)(uiMessageBus, uiSerializer);
|
||||
const renderer = new MessageBasedRenderer2(
|
||||
uiBrokerFactory, uiMessageBus, uiSerializer, uiRenderStore, domRendererFactory);
|
||||
renderer.start();
|
||||
|
Reference in New Issue
Block a user