mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
Revert "Rename all test files from JS -> ES6"
This reverts commit 2abe85b8344de1102c1589a9ac9421a8b296f2b5.
This commit is contained in:
@ -1,65 +0,0 @@
|
||||
import PreloadStore from "preload-store";
|
||||
import { Promise } from "rsvp";
|
||||
|
||||
QUnit.module("preload-store", {
|
||||
beforeEach() {
|
||||
PreloadStore.store("bane", "evil");
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("get", assert => {
|
||||
assert.blank(PreloadStore.get("joker"), "returns blank for a missing key");
|
||||
assert.equal(
|
||||
PreloadStore.get("bane"),
|
||||
"evil",
|
||||
"returns the value for that key"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("remove", assert => {
|
||||
PreloadStore.remove("bane");
|
||||
assert.blank(PreloadStore.get("bane"), "removes the value if the key exists");
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"getAndRemove returns a promise that resolves to null",
|
||||
async assert => {
|
||||
assert.blank(await PreloadStore.getAndRemove("joker"));
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"getAndRemove returns a promise that resolves to the result of the finder",
|
||||
async assert => {
|
||||
const finder = () => "batdance";
|
||||
const result = await PreloadStore.getAndRemove("joker", finder);
|
||||
|
||||
assert.equal(result, "batdance");
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"getAndRemove returns a promise that resolves to the result of the finder's promise",
|
||||
async assert => {
|
||||
const finder = () => Promise.resolve("hahahah");
|
||||
const result = await PreloadStore.getAndRemove("joker", finder);
|
||||
|
||||
assert.equal(result, "hahahah");
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test(
|
||||
"returns a promise that rejects with the result of the finder's rejected promise",
|
||||
async assert => {
|
||||
const finder = () => Promise.reject("error");
|
||||
|
||||
await PreloadStore.getAndRemove("joker", finder).catch(result => {
|
||||
assert.equal(result, "error");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("returns a promise that resolves to 'evil'", async assert => {
|
||||
const result = await PreloadStore.getAndRemove("bane");
|
||||
assert.equal(result, "evil");
|
||||
});
|
Reference in New Issue
Block a user