javascript - 测试覆盖颜色 - React Native App 的后端
问题描述
npm 运行测试:cov
服务器端编程非常新,需要一些指导。
在我下面的测试报告中,它说“如果”不包括在内。
无论我如何编写 if 逻辑,它都会引发此错误。
我该如何解决??
我应该在哪里寻找什么?
更新:
下面是我的测试数据:
const input = {
applicationId,
subApplicationId: 'test',
alert: '0 General',
badge: 1,
sound: 'default',
createDate: '2020-03-30T03:43:45.773Z',
data: JSON.stringify({
data: JSON.stringify({}),
}),
};
await notificationService.create(input);
});
it('General', async () => {
expect(
await notificationController.retrieve(
{
applicationId,
targetId: 'B9EF21EE-EA9B-4C9E-9D77-949A7A944AF9',
requestDate: '2020-04-01T00:00:00.000Z',
},
buildRequest({ isAuthorized: false }),
),
).toHaveLength(3);
});
it('General + Personal', async () => {
expect(
await notificationController.retrieve(
{
applicationId,
userId: '2019040913083656642537',
targetId: 'B9EF21EE-EA9B-4C9E-9D77-949A7A944AF9',
requestDate: '2020-04-01T00:00:00.000Z',
},
buildRequest({ isAuthorized: true }),
),
).toHaveLength(7);
});
it('General + Personal (with userId)', async () => {
expect(
await notificationController.retrieve(
{
applicationId,
userId: '2019040913083656642537',
requestDate: '2020-04-01T00:00:00.000Z',
},
buildRequest({ isAuthorized: true }),
),
).toHaveLength(2);
});
解决方案
推荐阅读
- json - 如何加密静态 sns 主题以避免云更改
- java - SpringBootTest 不导入本地属性
- html - 为什么视频标签上的“背景图片”只有在设置了“海报”属性的情况下才有效?
- flutter - 固定在每个屏幕上的浮动操作按钮
- excel - 如何遍历除一张以外的所有工作表?
- java - 标题和正文 - android 应用程序中的意图 Action_SEND
- google-kubernetes-engine - Google Kubernetes Engine:允许出口到 k8s-metadata-proxy 的 NetworkPolicy
- python - 当我在 jupyter notebook 中导入 matplotlib 时出现错误
- javascript - 将功能更改为 ES6 会出现故障
- r - 您如何在组中旋转较长的列?