mozilla/web-ext

Convert test suite to use sinon assertions

Offen

#972 geöffnet am 12.06.2017

 (12 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (380 Forks)github user discovery
Hacktoberfestcomponent: code qualitycontrib: assignedcontrib: mentor assigned

Repository-Metriken

Stars
 (3.089 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 2T 14h) (17 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide