【发布时间】:2020-04-07 14:49:20
【问题描述】:
我正在使用 MongoDB 数据库对我的 NodeJS-Typescript 应用程序进行集成测试。我使用 Jest 作为测试框架。如何用可用于测试的内存数据库(mongoDb)替换真实的数据库配置。谁能帮我配置一下?
config.ts
/**
* @file Configuration file - Testing Configuration.
*/
export default {
jwtPrivateKey: '11234.xsdfcswfe.23rcscdsfg',
// Testing Database configuration
MongoDB: {
dbConfig: {
user: 'xxxx',
password: 'xxxx',
host: '11.222.333.444',
port: '27017',
authMechanism: 'SCRAM-SHA-1',
authSource: 'permissionlevel',
dbName: 'sample_db'
}
}
};
【问题讨论】:
-
不要破坏您的帖子。通过在本网站上发布,您已不可撤销地授予 Stack Exchange 网络以CC BY-SA 4.0 license 分发该内容的权利,只要它认为合适即可。有关删除的替代方法,请参阅:I've thought better of my question; can I delete it?
标签: javascript node.js mongodb typescript jestjs