UNPKG

@finos/legend-shared

Version:
57 lines 2.92 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type SuperGenericFunction } from '../CommonUtils.js'; import { jest } from '@jest/globals'; /** * This is a pass through worker, it will post message, but do not ever reply so `onmessage` and `onerror` are never called */ export declare class PassThruWorker { url: string | URL; constructor(url: string | URL); postMessage: (message: unknown) => void; onmessageerror: (event: MessageEvent) => void; onmessage: (event: MessageEvent) => void; onerror: (event: ErrorEvent) => void; addEventListener: (type: string, listener: EventListener) => void; removeEventListener: (type: string, listener: EventListener) => void; terminate: () => void; dispatchEvent: (event: Event) => boolean; } export declare const integrationTest: (testName: string) => string; export declare const unitTest: (testName: string) => string; export declare const outputDOM: (element: Element) => void; /** * Currently, `jest-extended` augments the matchers from @types/jest instead of expect (or @jest/expect) * so we're stubbing this type for now. * See https://github.com/facebook/jest/issues/12424 * See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62037 */ export type TEMPORARY__JestMatcher = any; /** * This is a more ergonomic way to type mocks produced by `jest.fn` * See https://github.com/facebook/jest/issues/12479 */ export declare const createMock: <T extends SuperGenericFunction>(reference?: T) => jest.Mock<T>; /** * Since `jest.spyOn` has not been made global, this is just * a more ergonomic version of it * See https://github.com/jest-community/eslint-plugin-jest/issues/35#issuecomment-388386336 */ export declare const createSpy: { <T extends object, K extends import("jest-mock").PropertyLikeKeys<T>, V extends Required<T>[K], A extends "get" | "set">(object: T, methodKey: K, accessType: A): A extends "get" ? import("jest-mock").SpiedGetter<V> : A extends "set" ? import("jest-mock").SpiedSetter<V> : never; <T extends object, K extends import("jest-mock").ConstructorLikeKeys<T> | import("jest-mock").MethodLikeKeys<T>, V extends Required<T>[K]>(object: T, methodKey: K): V extends import("jest-mock").ClassLike | import("jest-mock").FunctionLike ? import("jest-mock").Spied<V> : never; }; //# sourceMappingURL=TestUtils.d.ts.map