Upgrade QUnit to latest version
This commit is contained in:
@@ -2,13 +2,13 @@ import { mapRoutes } from 'discourse/mapping-router';
|
||||
import Theme from 'admin/models/theme';
|
||||
|
||||
moduleFor('controller:admin-customize-themes', {
|
||||
setup() {
|
||||
beforeEach() {
|
||||
this.registry.register('router:main', mapRoutes());
|
||||
},
|
||||
needs: ['controller:adminUser']
|
||||
});
|
||||
|
||||
test("can list sorted themes", function() {
|
||||
QUnit.test("can list sorted themes", function(assert) {
|
||||
|
||||
const defaultTheme = Theme.create({id: 2, 'default': true, name: 'default'});
|
||||
const userTheme = Theme.create({id: 3, 'user_selectable': true, name: 'name'});
|
||||
@@ -23,7 +23,7 @@ test("can list sorted themes", function() {
|
||||
});
|
||||
|
||||
|
||||
deepEqual(controller.get('sortedThemes').map(t=>t.get('name')), [
|
||||
assert.deepEqual(controller.get('sortedThemes').map(t=>t.get('name')), [
|
||||
defaultTheme,
|
||||
userTheme,
|
||||
strayTheme1,
|
||||
|
||||
@@ -2,13 +2,13 @@ import Badge from 'discourse/models/badge';
|
||||
import { mapRoutes } from 'discourse/mapping-router';
|
||||
|
||||
moduleFor('controller:admin-user-badges', {
|
||||
setup() {
|
||||
beforeEach() {
|
||||
this.registry.register('router:main', mapRoutes());
|
||||
},
|
||||
needs: ['controller:adminUser']
|
||||
});
|
||||
|
||||
test("grantableBadges", function() {
|
||||
QUnit.test("grantableBadges", function(assert) {
|
||||
const badgeFirst = Badge.create({id: 3, name: "A Badge", enabled: true});
|
||||
const badgeMiddle = Badge.create({id: 1, name: "My Badge", enabled: true});
|
||||
const badgeLast = Badge.create({id: 2, name: "Zoo Badge", enabled: true});
|
||||
@@ -20,6 +20,6 @@ test("grantableBadges", function() {
|
||||
});
|
||||
|
||||
|
||||
not(badgeNames.includes(badgeDisabled), "excludes disabled badges");
|
||||
deepEqual(badgeNames, sortedNames, "sorts badges by name");
|
||||
assert.not(badgeNames.includes(badgeDisabled), "excludes disabled badges");
|
||||
assert.deepEqual(badgeNames, sortedNames, "sorts badges by name");
|
||||
});
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import { blank, present } from 'helpers/qunit-helpers';
|
||||
import AdminUser from 'admin/models/admin-user';
|
||||
import ApiKey from 'admin/models/api-key';
|
||||
|
||||
module("model:admin-user");
|
||||
QUnit.module("model:admin-user");
|
||||
|
||||
test('generate key', function(assert) {
|
||||
QUnit.test('generate key', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var adminUser = AdminUser.create({id: 333});
|
||||
assert.ok(!adminUser.get('api_key'), 'it has no api key by default');
|
||||
return adminUser.generateApiKey().then(function() {
|
||||
present(adminUser.get('api_key'), 'it has an api_key now');
|
||||
assert.present(adminUser.get('api_key'), 'it has an api_key now');
|
||||
});
|
||||
});
|
||||
|
||||
test('revoke key', function(assert) {
|
||||
QUnit.test('revoke key', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var apiKey = ApiKey.create({id: 1234, key: 'asdfasdf'}),
|
||||
@@ -22,6 +21,6 @@ test('revoke key', function(assert) {
|
||||
|
||||
assert.equal(adminUser.get('api_key'), apiKey, 'it has the api key in the beginning');
|
||||
return adminUser.revokeApiKey().then(function() {
|
||||
blank(adminUser.get('api_key'), 'it cleared the api_key');
|
||||
assert.blank(adminUser.get('api_key'), 'it cleared the api_key');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import Theme from 'admin/models/theme';
|
||||
|
||||
module("model:theme");
|
||||
QUnit.module("model:theme");
|
||||
|
||||
test('can add an upload correctly', function(assert) {
|
||||
QUnit.test('can add an upload correctly', function(assert) {
|
||||
let theme = Theme.create();
|
||||
|
||||
assert.equal(theme.get("uploads.length"), 0, "uploads should be an empty array");
|
||||
@@ -14,4 +14,4 @@ test('can add an upload correctly', function(assert) {
|
||||
assert.equal(fields[0].type_id, 2, 'expecting type id to be set');
|
||||
|
||||
assert.equal(theme.get("uploads.length"), 1, "expecting an upload");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user