mozilla/web-ext

Convert test suite to use sinon assertions

オープン

#972 opened on 2017/06/12

 (12 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (380 件のフォーク)github user discovery
Hacktoberfestcomponent: code qualitycontrib: assignedcontrib: mentor assigned

Repository metrics

Stars
 (3,089 個のスター)
PR merge metrics
 (平均マージ 2d 14h) (30d で 17 merged PRs)

説明

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})
);

コントリビューターガイド