node tests: Prevent theoretical leak from Intl.

Because `util` is so late in the alphabet, this
leak never surfaced in practice, but I tried running
the node tests in reverse, and this leak came
up if you ran `util` before `stream_list`.  I guess
it's nice that `stream_list` actually exercises
the difference between a dumb sort and an
Intl-aware sort.

It's possible that we should just assume that
Intl.Collator is always available at this point,
which would eliminate the need for this test.
This commit is contained in:
Steve Howell 2020-09-02 17:37:25 +00:00 committed by Steve Howell
parent fb96407607
commit 8a210923e1
1 changed files with 6 additions and 5 deletions

View File

@ -117,12 +117,13 @@ run_test("robust_uri_decode", () => {
});
run_test("dumb_strcmp", () => {
Intl.Collator = undefined;
with_field(Intl, "Collator", undefined, () => {
const strcmp = util.make_strcmp();
assert.equal(strcmp("a", "b"), -1);
assert.equal(strcmp("c", "c"), 0);
assert.equal(strcmp("z", "y"), 1);
});
});
run_test("get_edit_event_orig_topic", () => {
assert.equal(util.get_edit_event_orig_topic({orig_subject: "lunch"}), "lunch");