Skip to content

Commit 44b4428

Browse files
author
Mathias Lorenzen
committed
updates.
1 parent 2204e04 commit 44b4428

File tree

11 files changed

+4326
-24
lines changed

11 files changed

+4326
-24
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# FluffySpoon.JavaScript.Testing
1+
# substitute.js
22
More concretely named `@fluffy-spoon/substitute` on NPM is a TypeScript port of [NSubstitute](http://nsubstitute.github.io), which aims to provide a much more fluent mocking opportunity for strong-typed languages.
33

44
## Requirements
@@ -8,6 +8,8 @@ More concretely named `@fluffy-spoon/substitute` on NPM is a TypeScript port of
88
Experience full strong-typing of your fakes all the way, and let the TypeScript compiler help with all the dirty work! In the usage example given below, the `exFake` instance is strong-typed all the way, and can be used naturally in a fluent interface!
99

1010
```typescript
11+
import { Substitute } from '@fluffy-spoon/substitute';
12+
1113
class Example {
1214
a = "1337";
1315
b = 1337;

dist/spec/index.test.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export declare class Example {
2+
a: string;
3+
b: number;
4+
c(arg1: string, arg2: string): string;
5+
readonly d: number;
6+
v: any;
7+
}

dist/spec/index.test.js

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/spec/index.test.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export declare type FunctionSubstitute<F extends any[], T> = (...args: F) => (T & {
2+
returns: (...args: T[]) => void;
3+
});
4+
export declare type PropertySubstitute<T> = T & {
5+
returns: (...args: T[]) => void;
6+
};
7+
export declare type ObjectSubstitute<T extends Object> = {
8+
[P in keyof T]: T[P] extends (...args: infer F) => infer R ? FunctionSubstitute<F, R> : PropertySubstitute<T[P]>;
9+
};
10+
export declare class Substitute {
11+
static for<T>(): ObjectSubstitute<T>;
12+
}

dist/src/index.js

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)