TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to mock sequelize models in Nodejs?

1 点作者 sunilkumarc大约 8 年前
Hi Hackers,<p>I have been struggling a lot to mock database in one of my side projects while writing junits. Can somebody please help me out here. Below is what the scenario looks like:<p>Before that, the source code is here - https:&#x2F;&#x2F;github.com&#x2F;sunilkumarc&#x2F;track-courier<p>1. I have created a model using sequelize module in Nodejs. And I access my db through this model.<p>2. I want to mock the db calls when running junits. For example fineOne method here which return a promise. (https:&#x2F;&#x2F;github.com&#x2F;sunilkumarc&#x2F;track-courier&#x2F;blob&#x2F;master&#x2F;models&#x2F;parcels.js#L4). Basically when running this particular endpoint I want to skip accessing the db.<p>Any help is appreciated!<p>Regards, Sunil

暂无评论

暂无评论