Skip to content

Commit

Permalink
Merge pull request #2 from WezomCompany/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
OlehDutchenko authored Mar 7, 2021
2 parents 846392a + 18c4242 commit 3ad70ce
Show file tree
Hide file tree
Showing 6 changed files with 624 additions and 49 deletions.
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

---


## Usage

### Install npm package
Expand All @@ -45,35 +44,37 @@ Function signature test with set of custom cases

_Parameters:_

| Name | Data type | Argument | Default value | Description |
| ------ | --------- | -------- | ------------- | ----------- |
| method | `T` | | |
| cases | | | |
| Name | Data type | Argument | Default value | Description |
| ------ | ------------------------------------------------------------------------- | -------- | ------------- | ----------- |
| method | `T` | | |
| cases | `{ name?: string; parameters: Parameters<T>; expected: ReturnType<T> }[]` | | |

_Returns:_ `void`

_Examples:_

```ts
// x.ts
export const x = (y: boolean, z: number, w: number): number | null => (y ? z + w : null);

// x.spec.ts
import x from 'x.ts';
import { jestFunctionSignatureTest } from '@wezom/toolkit-jest';

describe('Function signature should match specification', () => {
jestFunctionSignatureTest(x, [
{
parameters: [true, 4, 5],
expected: 9
},
{
parameters: [false, 4, 5],
expected: null
}
]);
});
// x.ts
export const x = (y: boolean, z: number, w: number):number|null => y ? z + w : null;

// x.spec.ts
import x from 'x.ts'
import { jestFunctionSignatureTest } from '@wezom/toolkit-jest'

describe('Function signature should match specification', () => {
jestFunctionSignatureTest(x, [
{
parameters: [true, 4, 5],
expected: 9
},
{
name: 'Custom test name'
parameters: [false, 4, 5],
expected: null
}
]);
});

```

[comment]: <> (AUTODOC-TOOL-END)
Expand Down
Loading

0 comments on commit 3ad70ce

Please sign in to comment.