tachybase_todo/docs/plugins/tutorials/testing.md
chenos d5d0e1036b
docs: add docs (#75)
* docs: add docs

* ignore dumi theme test

* fix: error TS2717: Subsequent property declarations must have the same type.

* update docs

* deploy gh-pages

* plugins docs

* hash & cname

* exportStatic

* ssr

* vercel

* vercel

* fix: deploy vercel

* Delete vercel.json

* docs

* fix APP_DIST

* on master branch
2021-04-17 21:33:21 +08:00

565 B

title order toc
如何编写测试 4 menu

如何编写测试 未实现

NocoBase 提供了 @nocobase/test 用于编写和调试插件。

import { mockServer } from '@nocobase/test';

describe('test', () => {
  let api;

  beforeEach(async () => {
    api = mockServer({});
    await api.database.sync();
  });

  afterEach(async () => {
    await api.database.close();
  });

  it('test resource', () => {
    await app.resource('demos').get();
  });

  it('test request', () => {
    await app.request().get('/');
  });
});