DEV: test badge titles presence on badge page

follow-up on 2863e7c
This commit is contained in:
Maja Komel 2019-06-12 11:26:24 +02:00
parent 36e53db300
commit 621b6493f7
3 changed files with 49 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { acceptance } from "helpers/qunit-helpers";
import selectKit from "helpers/select-kit-helper";
import { acceptance, logIn } from "helpers/qunit-helpers";
acceptance("Badges");
@ -14,3 +15,13 @@ QUnit.test("Visit Badge Pages", async assert => {
assert.ok(exists(".user-info"), "has the list of users with that badge");
assert.ok(!exists(".badge-card:eq(0) script"));
});
QUnit.test("shows correct badge titles to choose from", async assert => {
logIn();
Discourse.reset();
const availableBadgeTitles = selectKit(".select-kit");
await visit("/badges/50/custombadge");
await availableBadgeTitles.expand();
assert.ok(availableBadgeTitles.rowByIndex(1).name() === "CustomBadge");
});

View File

@ -404,6 +404,30 @@ export default {
badge_type_id: 3
}
},
"/badges/50": {
badge_types: [
{
id: 3,
name: "Bronze"
}
],
badge: {
id: 50,
name: "CustomBadge",
description: null,
long_description: "",
grant_count: 10,
allow_title: true,
multiple_grant: true,
icon: "fa-certificate",
listable: true,
enabled: true,
badge_grouping_id: 1,
system: false,
badge_type_id: 3,
has_badge: true
}
},
"/user_badges.json": {
badges: [
{

View File

@ -36,6 +36,13 @@ export default {
name: "Badge 8",
description: null,
badge_type_id: 13
},
{
id: 50,
name: "CustomBadge",
description: null,
allow_title: true,
badge_type_id: 3
}
],
badge_types: [
@ -51,6 +58,12 @@ export default {
granted_at: "2014-03-09T20:30:01.420-04:00",
badge_id: 880,
granted_by_id: null
},
{
id: 669,
granted_at: "2014-03-09T20:30:01.420-04:00",
badge_id: 50,
granted_by_id: null
}
]
}