Nurturing Palpable Magnificence
    Wondering what’s next for npm?Check out our public roadmap! »

    @wezom/toolkit-jest
    TypeScript icon, indicating that this package has built-in type declarations

    3.1.1 • Public • Published

    @wezom/toolkit-jest

    Test Build

    Useful tools for working with Jest

    Statements Branches Functions Lines
    Statements Branches Functions Lines

    Table of Content:

    1. Usage
    2. Tools
      1. jestFunctionSignatureTest()
    3. Contributing
    4. License

    Usage

    Install npm package

    npm i @wezom/toolkit-jest

    ▲ Go Top | ▲ Table of Content


    Tools

    jestFunctionSignatureTest()

    Function signature test with set of custom cases

    Parameters:

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

    Returns: void

    Examples:

    // 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
    		}
    	]);
    });

    ▲ Go Top | ▲ Table of Content


    Contributing

    Please fill free to create issues or send PR

    Licence

    BSD-3-Clause License


    Install

    npm i @wezom/toolkit-jest

    DownloadsWeekly Downloads

    0

    Version

    3.1.1

    License

    BSD-3-Clause

    Unpacked Size

    9.19 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar