@midwayjs/hooks-testing-library
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

@midwayjs/hooks-testing-library

Usage

import { createApp, HooksApplication } from '@midwayjs/hooks-testing-library';
import api, { get, post } from './api.ts';

describe('test new features', () => {
  let app: HooksApplication;
  beforeAll(async () => {
    app = await createApp();
  });

  afterAll(async () => {
    await app.close();
  });

  it('runFunction', async () => {
    expect(await app.runFunction(api)).toMatchInlineSnapshot();
    expect(await app.runFunction(post, 'Jake')).toMatchInlineSnapshot();
  });

  it('request', async () => {
    const response = await app.request(get).expect(200);
    expect(response.body).toMatchInlineSnapshot();
  });
});

Readme

Keywords

Package Sidebar

Install

npm i @midwayjs/hooks-testing-library

Weekly Downloads

5

Version

2.3.0

License

MIT

Unpacked Size

12.4 kB

Total Files

13

Last publish

Collaborators

  • mariodu
  • czy88840616
  • legendecas
  • echosoar
  • lellansin
  • lxxyx
  • stone-jin