lopt – 洛普特区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,lopt – 洛普特区块链毕设代写 是一篇很好的国外资料

lopt

lopt - 洛普特

lopt is a utility package that can generate mock Solidity contracts in the form of fakes and mocks.

lopt is based in @eth-optimism/smock, sinon and sinon-chai.

Some benefits of using lopt:

  • Test syntax is easy to understand, just like sinon-chai
  • Supports both chai expect and should syntax
  • Fully typed objects, that will extend your contract functions when using typechain (highly recommended)
  • Mock and assert contract calls, without the need of even deploying it by using fakes
  • If you need your contract logic, just wrap it in a mock and start asserting calls or changing behaviour
  • Fully tested library

Documentation

Documentation is available here.


Installation

You can easily install lopt via npm:

npm install --save-dev @defi-wonderland/lopt 

Or via yarn:

yarn add --dev @defi-wonderland/lopt 

How to use

... import { FakeContract, lopt } from '@defi-wonderland/lopt';  chai.should(); // if you like should syntax chai.use(lopt.matchers);  describe('MyContract', () => {     let myContractFake: FakeContract<MyContract>;      beforeEach(async () => {         ...         myContractFake = await lopt.fake<MyContract>('MyContract');     });      it('some test', () => {         ...         myContractFake.bark.atCall(0).should.be.calledWith('Hello World');     }); });

Why the name lopt?

Loki’s alternative name is Lopt, and Loki was obviously taken.

Loki is the God of Mischief, a trickster, and the purpose of mocking libraries is basically to trick the tests.


文档

lopt是一个实用程序包,可以生成假货和仿制品形式的模拟实体合同

lopt总部位于@eth optimization/smock、sinon和sinon chai

使用lopt的一些好处:

这里提供了文档

  • 测试语法很容易理解,就像sinon chai
  • 支持chai expect和should语法
  • 完全类型化对象一样,当使用typechain(强烈推荐)时,它将扩展您的协定函数
  • Mock和assert协定调用,如果您需要契约逻辑,甚至不需要使用赝品来部署它,只需将它包装在一个mock中,并开始断言调用或更改经过充分测试的行为库
  • If you need your contract logic, just wrap it in a mock and start asserting calls or changing behaviour
  • Fully tested library

安装

您可以通过npm轻松安装lopt:


如何使用

或通过yarn:

npm install --save-dev @defi-wonderland/lopt 

Loki的替代名称是lopt,而Loki显然是被采用的

yarn add --dev @defi-wonderland/lopt 

为什么叫lopt

... import { FakeContract, lopt } from '@defi-wonderland/lopt';  chai.should(); // if you like should syntax chai.use(lopt.matchers);  describe('MyContract', () => {     let myContractFake: FakeContract<MyContract>;      beforeEach(async () => {         ...         myContractFake = await lopt.fake<MyContract>('MyContract');     });      it('some test', () => {         ...         myContractFake.bark.atCall(0).should.be.calledWith('Hello World');     }); });

Why the name lopt?

洛基是恶作剧之神,是个骗子,嘲笑库的目的基本上就是欺骗测试

Loki is the God of Mischief, a trickster, and the purpose of mocking libraries is basically to trick the tests.

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/23212.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » lopt – 洛普特区块链毕设代写

提供最优质的资源集合

立即查看 了解详情