Upgrade QUnit to latest version

This commit is contained in:
Robin Ward
2017-06-14 13:57:58 -04:00
parent 8ae445766f
commit cc525b1a8d
145 changed files with 7569 additions and 6763 deletions

View File

@ -1,74 +1,78 @@
import { blank } from 'helpers/qunit-helpers';
import PreloadStore from 'preload-store';
module("preload-store", {
setup() {
QUnit.module("preload-store", {
beforeEach() {
PreloadStore.store('bane', 'evil');
}
});
test("get", function() {
blank(PreloadStore.get('joker'), "returns blank for a missing key");
equal(PreloadStore.get('bane'), 'evil', "returns the value for that key");
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");
});
test("remove", function() {
QUnit.test("remove", assert => {
PreloadStore.remove('bane');
blank(PreloadStore.get('bane'), "removes the value if the key exists");
assert.blank(PreloadStore.get('bane'), "removes the value if the key exists");
});
asyncTestDiscourse("getAndRemove returns a promise that resolves to null", function() {
expect(1);
asyncTestDiscourse("getAndRemove returns a promise that resolves to null", function(assert) {
assert.expect(1);
const done = assert.async();
PreloadStore.getAndRemove('joker').then(function(result) {
blank(result);
start();
assert.blank(result);
done();
});
});
asyncTestDiscourse("getAndRemove returns a promise that resolves to the result of the finder", function() {
expect(1);
asyncTestDiscourse("getAndRemove returns a promise that resolves to the result of the finder", function(assert) {
assert.expect(1);
var finder = function() { return 'batdance'; };
const done = assert.async();
const finder = function() { return 'batdance'; };
PreloadStore.getAndRemove('joker', finder).then(function(result) {
equal(result, 'batdance');
start();
assert.equal(result, 'batdance');
done();
});
});
asyncTestDiscourse("getAndRemove returns a promise that resolves to the result of the finder's promise", function() {
expect(1);
asyncTestDiscourse("getAndRemove returns a promise that resolves to the result of the finder's promise", function(assert) {
assert.expect(1);
var finder = function() {
const finder = function() {
return new Ember.RSVP.Promise(function(resolve) { resolve('hahahah'); });
};
const done = assert.async();
PreloadStore.getAndRemove('joker', finder).then(function(result) {
equal(result, 'hahahah');
start();
assert.equal(result, 'hahahah');
done();
});
});
asyncTestDiscourse("returns a promise that rejects with the result of the finder's rejected promise", function() {
expect(1);
asyncTestDiscourse("returns a promise that rejects with the result of the finder's rejected promise", function(assert) {
assert.expect(1);
var finder = function() {
const finder = function() {
return new Ember.RSVP.Promise(function(resolve, reject) { reject('error'); });
};
const done = assert.async();
PreloadStore.getAndRemove('joker', finder).then(null, function(result) {
equal(result, 'error');
start();
assert.equal(result, 'error');
done();
});
});
asyncTestDiscourse("returns a promise that resolves to 'evil'", function() {
expect(1);
asyncTestDiscourse("returns a promise that resolves to 'evil'", function(assert) {
assert.expect(1);
const done = assert.async();
PreloadStore.getAndRemove('bane').then(function(result) {
equal(result, 'evil');
start();
assert.equal(result, 'evil');
done();
});
});