mozilla/web-ext

Convert test suite to use sinon assertions

開放

#972 建立於 2017年6月12日

 (12 則留言) (0 個反應) (0 位負責人)JavaScript (380 個分叉)github user discovery
Hacktoberfestcomponent: code qualitycontrib: assignedcontrib: mentor assigned

倉庫指標

星標
 (3,089 顆星)
PR 合併指標
 (平均合併 2天 14小時) (30 天內合併 17 個 PR)

描述

Is this a feature request or a bug?

feature

What is the current behavior?

In the test suite we do things like this to check that stub objects are called correctly:

assert.ok(addonReload.called);
assert.equal(addonReload.firstCall.args[0].addonId,
  tempInstallResult.addon.id);

What is the expected or desired behavior?

It works but the failure messages could be better. Let's switch all of this code to sinon assertions instead.

The above test would be rewritten as:

sinon.assert.calledWith(
  addonReload, sinon.match({addonId: tempInstallResult.addon.id})
);

貢獻者指南