简体   繁体   English

为arangodb编写模拟

[英]Writing mocks for arangodb

I was wondering if there is something that I can use to mock my database. 我想知道是否可以使用某些东西来模拟数据库。 Say a function makeRelations makes relation from a certain node to another. 说一个函数makeRelations使某个节点与另一个节点建立关系。 I want to test this function but without actually making a relation in my database. 我想测试此功能,但实际上未在数据库中建立任何关系。 Is there an easy way to do so ? 有一个简单的方法吗? I am using expect and mocha for testing. 我正在使用expectmocha进行测试。

To access database (I don't have experience with arangodb), you typically use some driver library. 要访问数据库(我没有使用arangodb的经验),通常会使用一些驱动程序库。 You can fake that driver library calls with proxyquire . 您可以使用proxyquire伪造该驱动程序库调用。

您正在测试某种程度上可能已经测试过的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM