Socket
Socket
Sign inDemoInstall

ts-mockito

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-mockito - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

4

lib/matcher/type/AnyOfClassMatcher.d.ts
import { Matcher } from "./Matcher";
export declare class AnyOfClassMatcher<T> extends Matcher {
private expectedClass;
constructor(expectedClass: {
new (...args: any[]): T;
});
constructor(expectedClass: new (...args: any[]) => T);
match(value: any): boolean;
toString(): string;
}

@@ -8,6 +8,6 @@ import { MethodStub } from "./stub/MethodStub";

hasMatchingInAnyGroup(args: any[]): boolean;
private removeIfNotLast(groupIndex, args);
private getFirstMatchingFromGroup(groupIndex, args);
private getFirstMatchingIndexFromGroup(groupIndex, args);
private getItemsCountInGroup(groupIndex);
private removeIfNotLast;
private getFirstMatchingFromGroup;
private getFirstMatchingIndexFromGroup;
private getItemsCountInGroup;
}
import { MethodToStub } from "./MethodToStub";
export declare class MethodStubSetter<T, ResolveType = void, RejectType = void> {
export declare class MethodStubSetter<T, ResolveType = void, RejectType = Error> {
private methodToStub;

@@ -11,3 +11,3 @@ private static globalGroupIndex;

thenResolve(...rest: ResolveType[]): this;
thenReject(...rest: RejectType[]): this;
thenReject(...rest: Error[]): this;
}

@@ -59,2 +59,5 @@ "use strict";

}
if (rest.length === 0) {
rest.push(new Error("mocked '" + this.methodToStub.name + "' rejected"));
}
rest.forEach(function (value) {

@@ -61,0 +64,0 @@ _this.methodToStub.methodStubCollection.add(new RejectPromiseMethodStub_1.RejectPromiseMethodStub(_this.groupIndex, _this.methodToStub.matchers, value));

@@ -28,8 +28,8 @@ import { Matcher } from "./matcher/type/Matcher";

protected getEmptyMethodStub(key: string, args: any[]): MethodStub;
private processClassCode(clazz);
private processFunctionsCode(object);
private createPropertyStub(key);
private createMethodStub(key);
private createMethodToStub(key);
private getMethodStub(key, args);
private processClassCode;
private processFunctionsCode;
private createPropertyStub;
private createMethodStub;
private createMethodToStub;
private getMethodStub;
}

@@ -5,9 +5,7 @@ import { ArgCaptor1, ArgCaptor10, ArgCaptor2, ArgCaptor3, ArgCaptor4, ArgCaptor5, ArgCaptor6, ArgCaptor7, ArgCaptor8, ArgCaptor9 } from "./capture/ArgCaptor";

export declare function spy<T>(instanceToSpy: T): T;
export declare function mock<T>(clazz: {
new (...args: any[]): T;
} | (Function & {
export declare function mock<T>(clazz: (new (...args: any[]) => T) | (Function & {
prototype: T;
})): T;
export declare function verify<T>(method: T): MethodStubVerificator<T>;
export declare function when<T>(method: Promise<T>): MethodStubSetter<Promise<T>, T, any>;
export declare function when<T>(method: Promise<T>): MethodStubSetter<Promise<T>, T, Error>;
export declare function when<T>(method: T): MethodStubSetter<T>;

@@ -27,5 +25,3 @@ export declare function instance<T>(mockedValue: T): T;

export declare function resetCalls<T>(mockedValue: T): void;
export declare function anyOfClass<T>(expectedClass: {
new (...args: any[]): T;
}): any;
export declare function anyOfClass<T>(expectedClass: new (...args: any[]) => T): any;
export declare function anyFunction(): any;

@@ -32,0 +28,0 @@ export declare function anyNumber(): any;

@@ -6,3 +6,3 @@ export declare class MockableFunctionsFinder {

find(code: string): string[];
private isMockable(name);
private isMockable;
}
{
"name": "ts-mockito",
"version": "2.3.1",
"version": "2.3.2",
"description": "Mocking library for TypeScript",

@@ -16,3 +16,3 @@ "main": "lib/ts-mockito.js",

"test:karma:watch": "./node_modules/.bin/karma start karma.conf.js",
"lint": "./node_modules/tslint/bin/tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts'"
"lint": "tslint -c tslint.json 'src/**/*.ts' 'test/**/*.ts'"
},

@@ -40,3 +40,3 @@ "author": "kuster.maciej@gmail.com",

"jasmine-core": "^2.8.0",
"jest": "^22.4.3",
"jest": "^23.5.0",
"karma": "^1.7.1",

@@ -53,3 +53,3 @@ "karma-chrome-launcher": "^2.2.0",

"ts-helpers": "^1.1.2",
"ts-jest": "^22.4.1",
"ts-jest": "^23.0.1",
"tslint": "^5.7.0",

@@ -62,3 +62,3 @@ "typescript": "^2.7.2"

"jest": {
"testEnvironment": "jsdom",
"testEnvironment": "node",
"transform": {

@@ -65,0 +65,0 @@ "^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js"

@@ -212,3 +212,3 @@ # ts-mockito [![build badge](https://travis-ci.org/NagRock/ts-mockito.svg?branch=master)](https://travis-ci.org/NagRock/ts-mockito) [![codecov](https://codecov.io/gh/NagRock/ts-mockito/branch/master/graph/badge.svg)](https://codecov.io/gh/NagRock/ts-mockito)

let mockedFoo:Foo = mock(Foo);
when(mockedFoo.getBar(1).thenReturn("one")).
when(mockedFoo.getBar(1)).thenReturn("one").

@@ -365,2 +365,2 @@ // Getting instance

* Thomas Hilzendegen (https://github.com/thomashilzendegen)
* Johan Blumenberg (https://github.com/johanblumenberg)
* Johan Blumenberg (https://github.com/johanblumenberg)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc