📜  承诺上的笑话单元测试 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:30.605000             🧑  作者: Mango

代码示例1
describe('Fetching', () = > {
  const filters = {
    startDate: '2015-09-01'
  };
  const api = new TestApiTransport();
  it('should reject if no startdate is given', async() = > {
    try {
      const r = await MyService.fetch()
    } catch (e) {
      expect(e).toBeTruthy()
    }
  });
  it('should return expected data', async() = > {
    const serviceObjects = await MyService.fetch(filters, null, api)
    expect(serviceObjects).toHaveLength(2);
  });
});