mirror of
https://github.com/discourse/discourse.git
synced 2025-06-08 00:27:32 +08:00
DEV: Import pretender instead of global server var (#8996)
* DEV: Remove server global test variable * Delete yarn-error.log * prettier and some eslint fixes * add global server variable back for plugins * rename imported server to pretender * prettier * support plugin server. usage * Export pretender as named * Prettier * change default pretender export * fix bad import * Use pretender() and original default export * export new Pretender as default * fix accidental change * WIP testing * add pretend handlers in correct location * move more stuff into the correct pretender * Consolidated more pretenders * comment out another bad test * fix user acceptance tests * commented out bad test * fixed another composer server stub * fix more tests * fixed tag test pretender * Fix admin email test * removed another draft handler * add back test * fix and uncomment another test * remove test that is not useful * remove commented out lines * reapply handlers between every test * no need to re-stub requests now :) * cleanup from review * more cleanup
This commit is contained in:

committed by
GitHub

parent
fedd8e3e3a
commit
176aa0ac7d
@ -1,4 +1,5 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Admin - Emails", { loggedIn: true });
|
acceptance("Admin - Emails", { loggedIn: true });
|
||||||
|
|
||||||
@ -16,15 +17,14 @@ Hello, this is a test!
|
|||||||
This part should be elided.`.trim();
|
This part should be elided.`.trim();
|
||||||
|
|
||||||
QUnit.test("shows selected and elided text", async assert => {
|
QUnit.test("shows selected and elided text", async assert => {
|
||||||
// prettier-ignore
|
pretender.post("/admin/email/advanced-test", () => {
|
||||||
server.post("/admin/email/advanced-test", () => { // eslint-disable-line no-undef
|
|
||||||
return [
|
return [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{
|
{
|
||||||
format: 1,
|
format: 1,
|
||||||
text: "Hello, this is a test!",
|
text: "Hello, this is a test!",
|
||||||
elided: "---\n\nThis part should be elided.",
|
elided: "---\n\nThis part should be elided."
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@ -2,19 +2,6 @@ import { acceptance } from "helpers/qunit-helpers";
|
|||||||
|
|
||||||
acceptance("Admin - User Emails", { loggedIn: true });
|
acceptance("Admin - User Emails", { loggedIn: true });
|
||||||
|
|
||||||
const responseWithSecondary = secondaryEmails => {
|
|
||||||
return [
|
|
||||||
200,
|
|
||||||
{ "Content-Type": "application/json" },
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
username: "eviltrout",
|
|
||||||
email: "eviltrout@example.com",
|
|
||||||
secondary_emails: secondaryEmails
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
const assertNoSecondary = assert => {
|
const assertNoSecondary = assert => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".display-row.email .value a").text(),
|
find(".display-row.email .value a").text(),
|
||||||
@ -31,49 +18,40 @@ const assertNoSecondary = assert => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const assertMultipleSecondary = assert => {
|
const assertMultipleSecondary = (assert, firstEmail, secondEmail) => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".display-row.secondary-emails .value li:first-of-type a").text(),
|
find(".display-row.secondary-emails .value li:first-of-type a").text(),
|
||||||
"eviltrout1@example.com",
|
firstEmail,
|
||||||
"it should display the first secondary email"
|
"it should display the first secondary email"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".display-row.secondary-emails .value li:last-of-type a").text(),
|
find(".display-row.secondary-emails .value li:last-of-type a").text(),
|
||||||
"eviltrout2@example.com",
|
secondEmail,
|
||||||
"it should display the second secondary email"
|
"it should display the second secondary email"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
QUnit.test("viewing self without secondary emails", async assert => {
|
QUnit.test("viewing self without secondary emails", async assert => {
|
||||||
// prettier-ignore
|
|
||||||
server.get("/admin/users/1.json", () => { // eslint-disable-line no-undef
|
|
||||||
return responseWithSecondary([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/admin/users/1/eviltrout");
|
await visit("/admin/users/1/eviltrout");
|
||||||
|
|
||||||
assertNoSecondary(assert);
|
assertNoSecondary(assert);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("viewing self with multiple secondary emails", async assert => {
|
QUnit.test("viewing self with multiple secondary emails", async assert => {
|
||||||
// prettier-ignore
|
await visit("/admin/users/3/markvanlan");
|
||||||
server.get("/admin/users/1.json", () => { // eslint-disable-line no-undef
|
|
||||||
return responseWithSecondary([
|
|
||||||
"eviltrout1@example.com",
|
|
||||||
"eviltrout2@example.com",
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/admin/users/1/eviltrout");
|
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".display-row.email .value a").text(),
|
find(".display-row.email .value a").text(),
|
||||||
"eviltrout@example.com",
|
"markvanlan@example.com",
|
||||||
"it should display the user's primary email"
|
"it should display the user's primary email"
|
||||||
);
|
);
|
||||||
|
|
||||||
assertMultipleSecondary(assert);
|
assertMultipleSecondary(
|
||||||
|
assert,
|
||||||
|
"markvanlan1@example.com",
|
||||||
|
"markvanlan2@example.com"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("viewing another user with no secondary email", async assert => {
|
QUnit.test("viewing another user with no secondary email", async assert => {
|
||||||
@ -84,20 +62,12 @@ QUnit.test("viewing another user with no secondary email", async assert => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("viewing another account with secondary emails", async assert => {
|
QUnit.test("viewing another account with secondary emails", async assert => {
|
||||||
// prettier-ignore
|
await visit("/admin/users/1235/regular1");
|
||||||
server.get("/u/regular/emails.json", () => { // eslint-disable-line no-undef
|
|
||||||
return [
|
|
||||||
200,
|
|
||||||
{ "Content-Type": "application/json" },
|
|
||||||
{
|
|
||||||
email: "eviltrout@example.com",
|
|
||||||
secondary_emails: ["eviltrout1@example.com", "eviltrout2@example.com"]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/admin/users/1234/regular");
|
|
||||||
await click(`.display-row.secondary-emails button`);
|
await click(`.display-row.secondary-emails button`);
|
||||||
|
|
||||||
assertMultipleSecondary(assert);
|
assertMultipleSecondary(
|
||||||
|
assert,
|
||||||
|
"regular2alt1@example.com",
|
||||||
|
"regular2alt2@example.com"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "helpers/select-kit-helper";
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Admin - User Index", {
|
acceptance("Admin - User Index", {
|
||||||
loggedIn: true,
|
loggedIn: true,
|
||||||
pretend(server, helper) {
|
pretend(pretenderServer, helper) {
|
||||||
server.get("/groups/search.json", () => {
|
pretenderServer.get("/groups/search.json", () => {
|
||||||
return helper.response([
|
return helper.response([
|
||||||
{
|
{
|
||||||
id: 42,
|
id: 42,
|
||||||
@ -35,8 +36,7 @@ acceptance("Admin - User Index", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("can edit username", async assert => {
|
QUnit.test("can edit username", async assert => {
|
||||||
/* global server */
|
pretender.put("/users/sam/preferences/username", () => [
|
||||||
server.put("/users/sam/preferences/username", () => [
|
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{ id: 2, username: "new-sam" }
|
{ id: 2, username: "new-sam" }
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
import pretender from "helpers/create-pretender";
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
|
||||||
acceptance("Click Track", {});
|
acceptance("Click Track", {});
|
||||||
|
|
||||||
QUnit.test("Do not track mentions", async assert => {
|
QUnit.test("Do not track mentions", async assert => {
|
||||||
/* global server */
|
pretender.post("/clicks/track", () => assert.ok(false));
|
||||||
server.post("/clicks/track", () => assert.ok(false));
|
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
assert.ok(invisible(".user-card"), "card should not appear");
|
assert.ok(invisible(".user-card"), "card should not appear");
|
||||||
|
@ -349,19 +349,21 @@ acceptance("Composer Actions With New Topic Draft", {
|
|||||||
},
|
},
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
_clearSnapshots();
|
_clearSnapshots();
|
||||||
},
|
|
||||||
pretend(server, helper) {
|
|
||||||
server.get("draft.json", () => {
|
|
||||||
return helper.response({
|
|
||||||
draft:
|
|
||||||
'{"reply":"dum de dum da ba.","action":"createTopic","title":"dum da ba dum dum","categoryId":null,"archetypeId":"regular","metaData":null,"composerTime":540879,"typingTime":3400}',
|
|
||||||
draft_sequence: 0
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stubDraftResponse = () => {
|
||||||
|
sandbox.stub(Draft, "get").returns(
|
||||||
|
Promise.resolve({
|
||||||
|
draft:
|
||||||
|
'{"reply":"dum de dum da ba.","action":"createTopic","title":"dum da ba dum dum","categoryId":null,"archetypeId":"regular","metaData":null,"composerTime":540879,"typingTime":3400}',
|
||||||
|
draft_sequence: 0
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
QUnit.test("shared draft", async assert => {
|
QUnit.test("shared draft", async assert => {
|
||||||
|
stubDraftResponse();
|
||||||
try {
|
try {
|
||||||
toggleCheckDraftPopup(true);
|
toggleCheckDraftPopup(true);
|
||||||
|
|
||||||
@ -399,6 +401,7 @@ QUnit.test("shared draft", async assert => {
|
|||||||
} finally {
|
} finally {
|
||||||
toggleCheckDraftPopup(false);
|
toggleCheckDraftPopup(false);
|
||||||
}
|
}
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("reply_as_new_topic with new_topic draft", async assert => {
|
QUnit.test("reply_as_new_topic with new_topic draft", async assert => {
|
||||||
@ -406,10 +409,12 @@ QUnit.test("reply_as_new_topic with new_topic draft", async assert => {
|
|||||||
await click(".create.reply");
|
await click(".create.reply");
|
||||||
const composerActions = selectKit(".composer-actions");
|
const composerActions = selectKit(".composer-actions");
|
||||||
await composerActions.expand();
|
await composerActions.expand();
|
||||||
|
stubDraftResponse();
|
||||||
await composerActions.selectRowByValue("reply_as_new_topic");
|
await composerActions.selectRowByValue("reply_as_new_topic");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find(".bootbox .modal-body").text(),
|
find(".bootbox .modal-body").text(),
|
||||||
I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
|
I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
|
||||||
);
|
);
|
||||||
await click(".modal-footer .btn.btn-default");
|
await click(".modal-footer .btn.btn-default");
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Composer - Edit conflict", {
|
acceptance("Composer - Edit conflict", {
|
||||||
loggedIn: true
|
loggedIn: true
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("Edit a post that causes an edit conflict", async assert => {
|
QUnit.test("Edit a post that causes an edit conflict", async assert => {
|
||||||
// prettier-ignore
|
|
||||||
server.put("/posts/398", () => [ // eslint-disable-line no-undef
|
|
||||||
409, { "Content-Type": "application/json" }, { errors: ["edit conflict"] }
|
|
||||||
]);
|
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click(".topic-post:eq(0) button.show-more-actions");
|
await click(".topic-post:eq(0) button.show-more-actions");
|
||||||
await click(".topic-post:eq(0) button.edit");
|
await click(".topic-post:eq(0) button.edit");
|
||||||
|
await fillIn(".d-editor-input", "this will 409");
|
||||||
await click("#reply-control button.create");
|
await click("#reply-control button.create");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find("#reply-control button.create")
|
find("#reply-control button.create")
|
||||||
@ -28,14 +25,33 @@ QUnit.test("Edit a post that causes an edit conflict", async assert => {
|
|||||||
await click(".modal .btn-primary");
|
await click(".modal .btn-primary");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleDraftPretender(assert) {
|
||||||
|
pretender.post("/draft.json", request => {
|
||||||
|
if (
|
||||||
|
request.requestBody.indexOf("%22reply%22%3A%22%22") === -1 &&
|
||||||
|
request.requestBody.indexOf("Any+plans+to+support+localization") !== -1
|
||||||
|
) {
|
||||||
|
assert.notEqual(request.requestBody.indexOf("originalText"), -1);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
request.requestBody.indexOf(
|
||||||
|
"draft_key=topic_280&sequence=4&data=%7B%22reply%22%3A%22hello+world+hello+world+hello+world+hello+world+hello+world%22%2C%22action%22%3A%22reply%22%2C%22categoryId%22%3A2%2C%22archetypeId%22%3A%22regular%22%2C%22metaData"
|
||||||
|
) !== -1
|
||||||
|
) {
|
||||||
|
assert.equal(
|
||||||
|
request.requestBody.indexOf("originalText"),
|
||||||
|
-1,
|
||||||
|
request.requestBody
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return [200, { "Content-Type": "application/json" }, { success: true }];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
QUnit.test(
|
QUnit.test(
|
||||||
"Should not send originalText when posting a new reply",
|
"Should not send originalText when posting a new reply",
|
||||||
async assert => {
|
async assert => {
|
||||||
// prettier-ignore
|
handleDraftPretender(assert);
|
||||||
server.post("/draft.json", request => { // eslint-disable-line no-undef
|
|
||||||
assert.equal(request.requestBody.indexOf("originalText"), -1, request.requestBody);
|
|
||||||
return [ 200, { "Content-Type": "application/json" }, { success: true } ];
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click(".topic-post:eq(0) button.reply");
|
await click(".topic-post:eq(0) button.reply");
|
||||||
@ -47,13 +63,7 @@ QUnit.test(
|
|||||||
);
|
);
|
||||||
|
|
||||||
QUnit.test("Should send originalText when editing a reply", async assert => {
|
QUnit.test("Should send originalText when editing a reply", async assert => {
|
||||||
// prettier-ignore
|
handleDraftPretender(assert);
|
||||||
server.post("/draft.json", request => { // eslint-disable-line no-undef
|
|
||||||
if (request.requestBody.indexOf("%22reply%22%3A%22%22") === -1) {
|
|
||||||
assert.notEqual(request.requestBody.indexOf("originalText"), -1);
|
|
||||||
}
|
|
||||||
return [ 200, { "Content-Type": "application/json" }, { success: true } ];
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click(".topic-post:eq(0) button.show-more-actions");
|
await click(".topic-post:eq(0) button.show-more-actions");
|
||||||
|
@ -2,17 +2,13 @@ import { run } from "@ember/runloop";
|
|||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "helpers/select-kit-helper";
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
||||||
|
import Draft from "discourse/models/draft";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
acceptance("Composer", {
|
acceptance("Composer", {
|
||||||
loggedIn: true,
|
loggedIn: true,
|
||||||
pretend(server, helper) {
|
pretend(pretenderServer, helper) {
|
||||||
server.get("/draft.json", () => {
|
pretenderServer.post("/uploads/lookup-urls", () => {
|
||||||
return helper.response({
|
|
||||||
draft: null,
|
|
||||||
draft_sequence: 42
|
|
||||||
});
|
|
||||||
});
|
|
||||||
server.post("/uploads/lookup-urls", () => {
|
|
||||||
return helper.response([]);
|
return helper.response([]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -617,14 +613,6 @@ QUnit.test("Checks for existing draft", async assert => {
|
|||||||
try {
|
try {
|
||||||
toggleCheckDraftPopup(true);
|
toggleCheckDraftPopup(true);
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
server.get("/draft.json", () => { // eslint-disable-line no-undef
|
|
||||||
return [ 200, { "Content-Type": "application/json" }, {
|
|
||||||
draft: "{\"reply\":\"This is a draft of the first post\",\"action\":\"reply\",\"categoryId\":1,\"archetypeId\":\"regular\",\"metaData\":null,\"composerTime\":2863,\"typingTime\":200}",
|
|
||||||
draft_sequence: 42
|
|
||||||
} ];
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
await click(".topic-post:eq(0) button.show-more-actions");
|
await click(".topic-post:eq(0) button.show-more-actions");
|
||||||
@ -646,18 +634,17 @@ QUnit.test("Can switch states without abandon popup", async assert => {
|
|||||||
|
|
||||||
const longText = "a".repeat(256);
|
const longText = "a".repeat(256);
|
||||||
|
|
||||||
|
sandbox.stub(Draft, "get").returns(
|
||||||
|
Promise.resolve({
|
||||||
|
draft: null,
|
||||||
|
draft_sequence: 0
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
await click(".btn-primary.create.btn");
|
await click(".btn-primary.create.btn");
|
||||||
|
|
||||||
await fillIn(".d-editor-input", longText);
|
await fillIn(".d-editor-input", longText);
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
server.get("/draft.json", () => { // eslint-disable-line no-undef
|
|
||||||
return [ 200, { "Content-Type": "application/json" }, {
|
|
||||||
draft: "{\"reply\":\"This is a draft of the first post\",\"action\":\"reply\",\"categoryId\":1,\"archetypeId\":\"regular\",\"metaData\":null,\"composerTime\":2863,\"typingTime\":200}",
|
|
||||||
draft_sequence: 42
|
|
||||||
} ];
|
|
||||||
});
|
|
||||||
|
|
||||||
await click("article#post_3 button.reply");
|
await click("article#post_3 button.reply");
|
||||||
|
|
||||||
const composerActions = selectKit(".composer-actions");
|
const composerActions = selectKit(".composer-actions");
|
||||||
@ -686,19 +673,20 @@ QUnit.test("Can switch states without abandon popup", async assert => {
|
|||||||
} finally {
|
} finally {
|
||||||
toggleCheckDraftPopup(false);
|
toggleCheckDraftPopup(false);
|
||||||
}
|
}
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("Loading draft also replaces the recipients", async assert => {
|
QUnit.test("Loading draft also replaces the recipients", async assert => {
|
||||||
try {
|
try {
|
||||||
toggleCheckDraftPopup(true);
|
toggleCheckDraftPopup(true);
|
||||||
|
|
||||||
// prettier-ignore
|
sandbox.stub(Draft, "get").returns(
|
||||||
server.get("/draft.json", () => { // eslint-disable-line no-undef
|
Promise.resolve({
|
||||||
return [ 200, { "Content-Type": "application/json" }, {
|
draft:
|
||||||
"draft":"{\"reply\":\"hello\",\"action\":\"privateMessage\",\"title\":\"hello\",\"categoryId\":null,\"archetypeId\":\"private_message\",\"metaData\":null,\"usernames\":\"codinghorror\",\"composerTime\":9159,\"typingTime\":2500}",
|
'{"reply":"hello","action":"privateMessage","title":"hello","categoryId":null,"archetypeId":"private_message","metaData":null,"usernames":"codinghorror","composerTime":9159,"typingTime":2500}',
|
||||||
"draft_sequence":0
|
draft_sequence: 0
|
||||||
} ];
|
})
|
||||||
});
|
);
|
||||||
|
|
||||||
await visit("/u/charlie");
|
await visit("/u/charlie");
|
||||||
await click("button.compose-pm");
|
await click("button.compose-pm");
|
||||||
|
@ -3,14 +3,6 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
|||||||
|
|
||||||
acceptance("Composer and uncategorized is not allowed", {
|
acceptance("Composer and uncategorized is not allowed", {
|
||||||
loggedIn: true,
|
loggedIn: true,
|
||||||
pretend(server, helper) {
|
|
||||||
server.get("/draft.json", () => {
|
|
||||||
return helper.response({
|
|
||||||
draft: null,
|
|
||||||
draft_sequence: 42
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
settings: {
|
settings: {
|
||||||
enable_whispers: true,
|
enable_whispers: true,
|
||||||
allow_uncategorized_topics: false
|
allow_uncategorized_topics: false
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "helpers/select-kit-helper";
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
let groupArgs = {
|
let groupArgs = {
|
||||||
settings: {
|
settings: {
|
||||||
enable_group_directory: true
|
enable_group_directory: true
|
||||||
},
|
},
|
||||||
pretend(server, helper) {
|
pretend(pretenderServer, helper) {
|
||||||
server.post("/groups/Macdonald/request_membership", () => {
|
pretenderServer.post("/groups/Macdonald/request_membership", () => {
|
||||||
return helper.response({
|
return helper.response({
|
||||||
relative_url: "/t/internationalization-localization/280"
|
relative_url: "/t/internationalization-localization/280"
|
||||||
});
|
});
|
||||||
@ -127,10 +128,12 @@ QUnit.test("User Viewing Group", async assert => {
|
|||||||
QUnit.test(
|
QUnit.test(
|
||||||
"Admin viewing group messages when there are no messages",
|
"Admin viewing group messages when there are no messages",
|
||||||
async assert => {
|
async assert => {
|
||||||
// prettier-ignore
|
pretender.get(
|
||||||
server.get("/topics/private-messages-group/eviltrout/discourse.json", () => { // eslint-disable-line no-undef
|
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||||
return response({ topic_list: { topics: [] } });
|
() => {
|
||||||
});
|
return response({ topic_list: { topics: [] } });
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
await visit("/g/discourse");
|
await visit("/g/discourse");
|
||||||
await click(".nav-pills li a[title='Messages']");
|
await click(".nav-pills li a[title='Messages']");
|
||||||
@ -146,87 +149,89 @@ QUnit.test(
|
|||||||
);
|
);
|
||||||
|
|
||||||
QUnit.test("Admin viewing group messages", async assert => {
|
QUnit.test("Admin viewing group messages", async assert => {
|
||||||
// prettier-ignore
|
pretender.get(
|
||||||
server.get("/topics/private-messages-group/eviltrout/discourse.json", () => { // eslint-disable-line no-undef
|
"/topics/private-messages-group/eviltrout/discourse.json",
|
||||||
return response({
|
() => {
|
||||||
users: [
|
return response({
|
||||||
{
|
users: [
|
||||||
id: 2,
|
|
||||||
username: "bruce1",
|
|
||||||
avatar_template:
|
|
||||||
"/user_avatar/meta.discourse.org/bruce1/{size}/5245.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
username: "CodingHorror",
|
|
||||||
avatar_template:
|
|
||||||
"/user_avatar/meta.discourse.org/codinghorror/{size}/5245.png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
primary_groups: [],
|
|
||||||
topic_list: {
|
|
||||||
can_create_topic: true,
|
|
||||||
draft: null,
|
|
||||||
draft_key: "new_topic",
|
|
||||||
draft_sequence: 0,
|
|
||||||
per_page: 30,
|
|
||||||
topics: [
|
|
||||||
{
|
{
|
||||||
id: 12199,
|
id: 2,
|
||||||
title: "This is a private message 1",
|
username: "bruce1",
|
||||||
fancy_title: "This is a private message 1",
|
avatar_template:
|
||||||
slug: "this-is-a-private-message-1",
|
"/user_avatar/meta.discourse.org/bruce1/{size}/5245.png"
|
||||||
posts_count: 0,
|
},
|
||||||
reply_count: 0,
|
{
|
||||||
highest_post_number: 0,
|
id: 3,
|
||||||
image_url: null,
|
username: "CodingHorror",
|
||||||
created_at: "2018-03-16T03:38:45.583Z",
|
avatar_template:
|
||||||
last_posted_at: null,
|
"/user_avatar/meta.discourse.org/codinghorror/{size}/5245.png"
|
||||||
bumped: true,
|
|
||||||
bumped_at: "2018-03-16T03:38:45.583Z",
|
|
||||||
unseen: false,
|
|
||||||
pinned: false,
|
|
||||||
unpinned: null,
|
|
||||||
visible: true,
|
|
||||||
closed: false,
|
|
||||||
archived: false,
|
|
||||||
bookmarked: null,
|
|
||||||
liked: null,
|
|
||||||
views: 0,
|
|
||||||
like_count: 0,
|
|
||||||
has_summary: false,
|
|
||||||
archetype: "private_message",
|
|
||||||
last_poster_username: "bruce1",
|
|
||||||
category_id: null,
|
|
||||||
pinned_globally: false,
|
|
||||||
featured_link: null,
|
|
||||||
posters: [
|
|
||||||
{
|
|
||||||
extras: "latest single",
|
|
||||||
description: "Original Poster, Most Recent Poster",
|
|
||||||
user_id: 2,
|
|
||||||
primary_group_id: null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
participants: [
|
|
||||||
{
|
|
||||||
extras: "latest",
|
|
||||||
description: null,
|
|
||||||
user_id: 2,
|
|
||||||
primary_group_id: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
extras: null,
|
|
||||||
description: null,
|
|
||||||
user_id: 3,
|
|
||||||
primary_group_id: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
primary_groups: [],
|
||||||
});
|
topic_list: {
|
||||||
});
|
can_create_topic: true,
|
||||||
|
draft: null,
|
||||||
|
draft_key: "new_topic",
|
||||||
|
draft_sequence: 0,
|
||||||
|
per_page: 30,
|
||||||
|
topics: [
|
||||||
|
{
|
||||||
|
id: 12199,
|
||||||
|
title: "This is a private message 1",
|
||||||
|
fancy_title: "This is a private message 1",
|
||||||
|
slug: "this-is-a-private-message-1",
|
||||||
|
posts_count: 0,
|
||||||
|
reply_count: 0,
|
||||||
|
highest_post_number: 0,
|
||||||
|
image_url: null,
|
||||||
|
created_at: "2018-03-16T03:38:45.583Z",
|
||||||
|
last_posted_at: null,
|
||||||
|
bumped: true,
|
||||||
|
bumped_at: "2018-03-16T03:38:45.583Z",
|
||||||
|
unseen: false,
|
||||||
|
pinned: false,
|
||||||
|
unpinned: null,
|
||||||
|
visible: true,
|
||||||
|
closed: false,
|
||||||
|
archived: false,
|
||||||
|
bookmarked: null,
|
||||||
|
liked: null,
|
||||||
|
views: 0,
|
||||||
|
like_count: 0,
|
||||||
|
has_summary: false,
|
||||||
|
archetype: "private_message",
|
||||||
|
last_poster_username: "bruce1",
|
||||||
|
category_id: null,
|
||||||
|
pinned_globally: false,
|
||||||
|
featured_link: null,
|
||||||
|
posters: [
|
||||||
|
{
|
||||||
|
extras: "latest single",
|
||||||
|
description: "Original Poster, Most Recent Poster",
|
||||||
|
user_id: 2,
|
||||||
|
primary_group_id: null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
participants: [
|
||||||
|
{
|
||||||
|
extras: "latest",
|
||||||
|
description: null,
|
||||||
|
user_id: 2,
|
||||||
|
primary_group_id: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extras: null,
|
||||||
|
description: null,
|
||||||
|
user_id: 3,
|
||||||
|
primary_group_id: null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
await visit("/g/discourse");
|
await visit("/g/discourse");
|
||||||
await click(".nav-pills li a[title='Messages']");
|
await click(".nav-pills li a[title='Messages']");
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Keyboard Shortcuts", { loggedIn: true });
|
acceptance("Keyboard Shortcuts", { loggedIn: true });
|
||||||
|
|
||||||
test("go to first suggested topic", async assert => {
|
test("go to first suggested topic", async assert => {
|
||||||
/* global server */
|
pretender.get("/t/27331/4.json", () => [
|
||||||
server.get("/t/27331/4.json", () => [
|
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{}
|
{}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
server.get("/t/27331.json", () => [
|
pretender.get("/t/27331.json", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{}
|
{}
|
||||||
@ -20,7 +20,7 @@ test("go to first suggested topic", async assert => {
|
|||||||
* No suggested topics exist.
|
* No suggested topics exist.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
server.get("/t/9/last.json", () => [
|
pretender.get("/t/9/last.json", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{}
|
{}
|
||||||
@ -44,7 +44,7 @@ test("go to first suggested topic", async assert => {
|
|||||||
* Suggested topic is returned by server.
|
* Suggested topic is returned by server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
server.get("/t/28830/last.json", () => [
|
pretender.get("/t/28830/last.json", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Login with email - hide email address taken", {
|
acceptance("Login with email - hide email address taken", {
|
||||||
settings: {
|
settings: {
|
||||||
@ -10,8 +11,7 @@ acceptance("Login with email - hide email address taken", {
|
|||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
};
|
};
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.post("/u/email-login", () => {
|
||||||
server.post("/u/email-login", () => { // eslint-disable-line no-undef
|
|
||||||
return response({ success: "OK" });
|
return response({ success: "OK" });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { updateCurrentUser, acceptance } from "helpers/qunit-helpers";
|
import { updateCurrentUser, acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
acceptance("Tags", { loggedIn: true });
|
acceptance("Tags", { loggedIn: true });
|
||||||
|
|
||||||
QUnit.test("list the tags", async assert => {
|
QUnit.test("list the tags", async assert => {
|
||||||
@ -19,48 +21,6 @@ acceptance("Tags listed by group", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("list the tags in groups", async assert => {
|
QUnit.test("list the tags in groups", async assert => {
|
||||||
// prettier-ignore
|
|
||||||
server.get("/tags", () => { // eslint-disable-line no-undef
|
|
||||||
return [
|
|
||||||
200,
|
|
||||||
{ "Content-Type": "application/json" },
|
|
||||||
{
|
|
||||||
tags: [
|
|
||||||
{ id: "planned", text: "planned", count: 7, pm_count: 0 },
|
|
||||||
{ id: "private", text: "private", count: 0, pm_count: 7 }
|
|
||||||
],
|
|
||||||
extras: {
|
|
||||||
tag_groups: [
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "Ford Cars",
|
|
||||||
tags: [
|
|
||||||
{ id: "Escort", text: "Escort", count: 1, pm_count: 0 },
|
|
||||||
{ id: "focus", text: "focus", count: 3, pm_count: 0 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "Honda Cars",
|
|
||||||
tags: [
|
|
||||||
{ id: "civic", text: "civic", count: 4, pm_count: 0 },
|
|
||||||
{ id: "accord", text: "accord", count: 2, pm_count: 0 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "Makes",
|
|
||||||
tags: [
|
|
||||||
{ id: "ford", text: "ford", count: 5, pm_count: 0 },
|
|
||||||
{ id: "honda", text: "honda", count: 6, pm_count: 0 }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/tags");
|
await visit("/tags");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
$(".tag-list").length,
|
$(".tag-list").length,
|
||||||
@ -102,14 +62,13 @@ QUnit.test("list the tags in groups", async assert => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("new topic button is not available for staff-only tags", async assert => {
|
test("new topic button is not available for staff-only tags", async assert => {
|
||||||
/* global server */
|
pretender.get("/tag/regular-tag/notifications", () => [
|
||||||
server.get("/tag/regular-tag/notifications", () => [
|
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{ tag_notification: { id: "regular-tag", notification_level: 1 } }
|
{ tag_notification: { id: "regular-tag", notification_level: 1 } }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
server.get("/tag/regular-tag/l/latest.json", () => [
|
pretender.get("/tag/regular-tag/l/latest.json", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{
|
{
|
||||||
@ -133,13 +92,13 @@ test("new topic button is not available for staff-only tags", async assert => {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
server.get("/tag/staff-only-tag/notifications", () => [
|
pretender.get("/tag/staff-only-tag/notifications", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{ tag_notification: { id: "staff-only-tag", notification_level: 1 } }
|
{ tag_notification: { id: "staff-only-tag", notification_level: 1 } }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
server.get("/tag/staff-only-tag/l/latest.json", () => [
|
pretender.get("/tag/staff-only-tag/l/latest.json", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{
|
{
|
||||||
@ -286,7 +245,7 @@ test("tag info can show synonyms", async assert => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("admin can manage tags", async assert => {
|
test("admin can manage tags", async assert => {
|
||||||
server.delete("/tag/planters/synonyms/containers", () => [
|
pretender.delete("/tag/planters/synonyms/containers", () => [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{ success: true }
|
{ success: true }
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
import Draft from "discourse/models/draft";
|
||||||
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
acceptance("User", { loggedIn: true });
|
acceptance("User", { loggedIn: true });
|
||||||
|
|
||||||
QUnit.test("Invalid usernames", async assert => {
|
QUnit.test("Invalid usernames", async assert => {
|
||||||
// prettier-ignore
|
pretender.get("/u/eviltrout%2F..%2F..%2F.json", () => {
|
||||||
server.get("/u/eviltrout%2F..%2F..%2F.json", () => { // eslint-disable-line no-undef
|
|
||||||
return [400, { "Content-Type": "application/json" }, {}];
|
return [400, { "Content-Type": "application/json" }, {}];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,13 +69,12 @@ QUnit.test("Viewing Summary", async assert => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("Viewing Drafts", async assert => {
|
QUnit.test("Viewing Drafts", async assert => {
|
||||||
// prettier-ignore
|
sandbox.stub(Draft, "get").returns(
|
||||||
server.get("/draft.json", () => { // eslint-disable-line no-undef
|
Promise.resolve({
|
||||||
return [ 200, { "Content-Type": "application/json" }, {
|
draft: null,
|
||||||
draft: "{\"reply\":\"This is a draft of the first post\",\"action\":\"reply\",\"categoryId\":1,\"archetypeId\":\"regular\",\"metaData\":null,\"composerTime\":2863,\"typingTime\":200}",
|
draft_sequence: 0
|
||||||
draft_sequence: 42
|
})
|
||||||
} ];
|
);
|
||||||
});
|
|
||||||
|
|
||||||
await visit("/u/eviltrout/activity/drafts");
|
await visit("/u/eviltrout/activity/drafts");
|
||||||
assert.ok(exists(".user-stream"), "has drafts stream");
|
assert.ok(exists(".user-stream"), "has drafts stream");
|
||||||
@ -87,4 +88,5 @@ QUnit.test("Viewing Drafts", async assert => {
|
|||||||
exists(".d-editor-input"),
|
exists(".d-editor-input"),
|
||||||
"composer is visible after resuming a draft"
|
"composer is visible after resuming a draft"
|
||||||
);
|
);
|
||||||
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
moduleForComponent("admin-report", {
|
moduleForComponent("admin-report", {
|
||||||
integration: true
|
integration: true
|
||||||
@ -133,13 +134,18 @@ componentTest("exception", {
|
|||||||
|
|
||||||
componentTest("rate limited", {
|
componentTest("rate limited", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
const response = object => {
|
pretender.get("/admin/reports/bulk", () => {
|
||||||
return [429, { "Content-Type": "application/json" }, object];
|
return [
|
||||||
};
|
429,
|
||||||
|
{ "Content-Type": "application/json" },
|
||||||
// prettier-ignore
|
{
|
||||||
server.get("/admin/reports/bulk", () => { //eslint-disable-line
|
errors: [
|
||||||
return response({"errors":["You’ve performed this action too many times. Please wait 10 seconds before trying again."],"error_type":"rate_limit","extras":{"wait_seconds":10}});
|
"You’ve performed this action too many times. Please wait 10 seconds before trying again."
|
||||||
|
],
|
||||||
|
error_type: "rate_limit",
|
||||||
|
extras: { wait_seconds: 10 }
|
||||||
|
}
|
||||||
|
];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import selectKit from "helpers/select-kit-helper";
|
import selectKit from "helpers/select-kit-helper";
|
||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
moduleForComponent("badge-title", { integration: true });
|
moduleForComponent("badge-title", { integration: true });
|
||||||
|
|
||||||
@ -23,8 +24,7 @@ componentTest("badge title", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
/* global server */
|
pretender.put("/u/eviltrout/preferences/badge_title", () => [
|
||||||
server.put("/u/eviltrout/preferences/badge_title", () => [
|
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{}
|
{}
|
||||||
|
@ -2,6 +2,7 @@ import componentTest from "helpers/component-test";
|
|||||||
import { testSelectKitModule } from "./select-kit-test-helper";
|
import { testSelectKitModule } from "./select-kit-test-helper";
|
||||||
import Site from "discourse/models/site";
|
import Site from "discourse/models/site";
|
||||||
import { set } from "@ember/object";
|
import { set } from "@ember/object";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
testSelectKitModule("tag-drop", {
|
testSelectKitModule("tag-drop", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -12,19 +13,14 @@ testSelectKitModule("tag-drop", {
|
|||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
};
|
};
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.get("/tags/filter/search", params => {
|
||||||
server.get("/tags/filter/search", (params) => { //eslint-disable-line
|
|
||||||
if (params.queryParams.q === "rég") {
|
if (params.queryParams.q === "rég") {
|
||||||
return response({
|
return response({
|
||||||
"results": [
|
results: [{ id: "régis", text: "régis", count: 2, pm_count: 0 }]
|
||||||
{ "id": "régis", "text": "régis", "count": 2, "pm_count": 0 }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}else if (params.queryParams.q === "dav") {
|
} else if (params.queryParams.q === "dav") {
|
||||||
return response({
|
return response({
|
||||||
"results": [
|
results: [{ id: "David", text: "David", count: 2, pm_count: 0 }]
|
||||||
{ "id": "David", "text": "David", "count": 2, "pm_count": 0 }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import componentTest from "helpers/component-test";
|
import componentTest from "helpers/component-test";
|
||||||
import { testSelectKitModule } from "./select-kit-test-helper";
|
import { testSelectKitModule } from "./select-kit-test-helper";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
testSelectKitModule("user-chooser");
|
testSelectKitModule("user-chooser");
|
||||||
|
|
||||||
@ -42,9 +43,8 @@ componentTest("can add a username", {
|
|||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
};
|
};
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.get("/u/search/users", () => {
|
||||||
server.get("/u/search/users", () => { //eslint-disable-line
|
return response({ users: [{ username: "maja", name: "Maja" }] });
|
||||||
return response({users:[{username: "maja", name: "Maja"}]});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import PostStream from "discourse/models/post-stream";
|
|||||||
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
import { Placeholder } from "discourse/lib/posts-with-placeholders";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
moduleFor("controller:topic", "controller:topic", {
|
moduleFor("controller:topic", "controller:topic", {
|
||||||
needs: [
|
needs: [
|
||||||
@ -522,8 +523,7 @@ QUnit.test("topVisibleChanged", function(assert) {
|
|||||||
QUnit.test(
|
QUnit.test(
|
||||||
"deletePost - no modal is shown if post does not have replies",
|
"deletePost - no modal is shown if post does not have replies",
|
||||||
function(assert) {
|
function(assert) {
|
||||||
/* global server */
|
pretender.get("/posts/2/reply-ids.json", () => {
|
||||||
server.get("/posts/2/reply-ids.json", () => {
|
|
||||||
return [200, { "Content-Type": "application/json" }, []];
|
return [200, { "Content-Type": "application/json" }, []];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,5 +2,20 @@ export default {
|
|||||||
"/draft.json": {
|
"/draft.json": {
|
||||||
draft: null,
|
draft: null,
|
||||||
draft_sequence: 0
|
draft_sequence: 0
|
||||||
|
},
|
||||||
|
"/draft.json?draft_key=topic_280": {
|
||||||
|
draft:
|
||||||
|
'{"reply":"This is a draft of the first post","action":"reply","categoryId":1,"archetypeId":"regular","metaData":null,"composerTime":2863,"typingTime":200}',
|
||||||
|
draft_sequence: 42
|
||||||
|
},
|
||||||
|
"/draft.json?draft_key=topic_281": {
|
||||||
|
draft:
|
||||||
|
'{"reply":"dum de dum da ba.","action":"createTopic","title":"dum da ba dum dum","categoryId":null,"archetypeId":"regular","metaData":null,"composerTime":540879,"typingTime":3400}',
|
||||||
|
draft_sequence: 0
|
||||||
|
},
|
||||||
|
"/draft.json?draft_key=topic_9": {
|
||||||
|
draft:
|
||||||
|
'{"reply":"This is a draft of the first post","action":"reply","categoryId":1,"archetypeId":"regular","metaData":null,"composerTime":2863,"typingTime":200}',
|
||||||
|
draft_sequence: 42
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ import DiscourseURL from "discourse/lib/url";
|
|||||||
import ClickTrack from "discourse/lib/click-track";
|
import ClickTrack from "discourse/lib/click-track";
|
||||||
import { fixture, logIn } from "helpers/qunit-helpers";
|
import { fixture, logIn } from "helpers/qunit-helpers";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:click-track-edit-history", {
|
QUnit.module("lib:click-track-edit-history", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -62,8 +63,7 @@ QUnit.skip("tracks internal URLs", async assert => {
|
|||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
||||||
@ -78,8 +78,7 @@ QUnit.skip("tracks external URLs", async assert => {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
@ -97,8 +96,7 @@ QUnit.skip(
|
|||||||
User.currentProp("external_links_in_new_tab", true);
|
User.currentProp("external_links_in_new_tab", true);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import ClickTrack from "discourse/lib/click-track";
|
import ClickTrack from "discourse/lib/click-track";
|
||||||
import { fixture, logIn } from "helpers/qunit-helpers";
|
import { fixture, logIn } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:click-track-profile-page", {
|
QUnit.module("lib:click-track-profile-page", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -55,8 +56,7 @@ QUnit.skip("tracks internal URLs", async assert => {
|
|||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com");
|
assert.equal(request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -68,8 +68,7 @@ QUnit.skip("tracks external URLs", async assert => {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
@ -84,8 +83,7 @@ QUnit.skip("tracks external URLs in other posts", async assert => {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331"
|
"url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331"
|
||||||
|
@ -3,6 +3,7 @@ import DiscourseURL from "discourse/lib/url";
|
|||||||
import ClickTrack from "discourse/lib/click-track";
|
import ClickTrack from "discourse/lib/click-track";
|
||||||
import { fixture, logIn } from "helpers/qunit-helpers";
|
import { fixture, logIn } from "helpers/qunit-helpers";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:click-track", {
|
QUnit.module("lib:click-track", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -55,8 +56,7 @@ QUnit.skip("tracks internal URLs", async assert => {
|
|||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
||||||
@ -74,8 +74,7 @@ QUnit.skip("does not track elements with no href", async assert => {
|
|||||||
QUnit.skip("does not track attachments", async assert => {
|
QUnit.skip("does not track attachments", async assert => {
|
||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
|
||||||
/* global server */
|
pretender.post("/clicks/track", () => assert.ok(false));
|
||||||
server.post("/clicks/track", () => assert.ok(false));
|
|
||||||
|
|
||||||
assert.notOk(track(generateClickEventOn(".attachment")));
|
assert.notOk(track(generateClickEventOn(".attachment")));
|
||||||
assert.ok(
|
assert.ok(
|
||||||
@ -89,8 +88,7 @@ QUnit.skip("tracks external URLs", async assert => {
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
@ -108,8 +106,7 @@ QUnit.skip(
|
|||||||
User.currentProp("external_links_in_new_tab", true);
|
User.currentProp("external_links_in_new_tab", true);
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
pretender.post("/clicks/track", request => {
|
||||||
server.post("/clicks/track", request => {
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.requestBody,
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
|
@ -3,12 +3,12 @@ import {
|
|||||||
linkSeenMentions
|
linkSeenMentions
|
||||||
} from "discourse/lib/link-mentions";
|
} from "discourse/lib/link-mentions";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:link-mentions");
|
QUnit.module("lib:link-mentions");
|
||||||
|
|
||||||
QUnit.test("linkSeenMentions replaces users and groups", async assert => {
|
QUnit.test("linkSeenMentions replaces users and groups", async assert => {
|
||||||
/* global server */
|
pretender.get("/u/is_local_username", () => [
|
||||||
server.get("/u/is_local_username", () => [
|
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/json" },
|
{ "Content-Type": "application/json" },
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,6 @@ QUnit.test("load - failed onebox", async assert => {
|
|||||||
let element = document.createElement("A");
|
let element = document.createElement("A");
|
||||||
element.setAttribute("href", "http://somebadurl.com");
|
element.setAttribute("href", "http://somebadurl.com");
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
server.get("/onebox", () => { //eslint-disable-line
|
|
||||||
return [404, {}, {}];
|
|
||||||
});
|
|
||||||
|
|
||||||
await loadOnebox(element);
|
await loadOnebox(element);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
@ -55,11 +50,6 @@ QUnit.test("load - successful onebox", async assert => {
|
|||||||
</aside>
|
</aside>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
server.get("/onebox", () => { //eslint-disable-line
|
|
||||||
return [200, {}, html];
|
|
||||||
});
|
|
||||||
|
|
||||||
let element = document.createElement("A");
|
let element = document.createElement("A");
|
||||||
element.setAttribute("href", "http://somegoodurl.com");
|
element.setAttribute("href", "http://somegoodurl.com");
|
||||||
|
|
||||||
@ -72,7 +62,7 @@ QUnit.test("load - successful onebox", async assert => {
|
|||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
loadOnebox(element),
|
loadOnebox(element),
|
||||||
stringToHTML(html).outerHTML,
|
html.trim(),
|
||||||
"it returns the html from the cache"
|
"it returns the html from the cache"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import TopicTrackingState from "discourse/models/topic-tracking-state";
|
import TopicTrackingState from "discourse/models/topic-tracking-state";
|
||||||
import Session from "discourse/models/session";
|
import Session from "discourse/models/session";
|
||||||
import ScreenTrack from "discourse/lib/screen-track";
|
import ScreenTrack from "discourse/lib/screen-track";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
let clock;
|
let clock;
|
||||||
|
|
||||||
@ -18,8 +19,7 @@ QUnit.module("lib:screen-track", {
|
|||||||
QUnit.skip("Correctly flushes posts as needed", assert => {
|
QUnit.skip("Correctly flushes posts as needed", assert => {
|
||||||
const timings = [];
|
const timings = [];
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.post("/topics/timings", t => {
|
||||||
server.post("/topics/timings", t => { //eslint-disable-line
|
|
||||||
timings.push(t);
|
timings.push(t);
|
||||||
return [200, {}, ""];
|
return [200, {}, ""];
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
} from "pretty-text/upload-short-url";
|
} from "pretty-text/upload-short-url";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { fixture } from "helpers/qunit-helpers";
|
import { fixture } from "helpers/qunit-helpers";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:pretty-text/upload-short-url", {
|
QUnit.module("lib:pretty-text/upload-short-url", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -46,8 +47,7 @@ QUnit.module("lib:pretty-text/upload-short-url", {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.post("/uploads/lookup-urls", () => {
|
||||||
server.post("/uploads/lookup-urls", () => { //eslint-disable-line
|
|
||||||
return response(imageSrcs.concat(attachmentSrcs.concat(otherMediaSrcs)));
|
return response(imageSrcs.concat(attachmentSrcs.concat(otherMediaSrcs)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import userSearch from "discourse/lib/user-search";
|
import userSearch from "discourse/lib/user-search";
|
||||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("lib:user-search", {
|
QUnit.module("lib:user-search", {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -7,13 +8,11 @@ QUnit.module("lib:user-search", {
|
|||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
};
|
};
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.get("/u/search/users", request => {
|
||||||
server.get("/u/search/users", request => { //eslint-disable-line
|
|
||||||
|
|
||||||
// special responder for per category search
|
// special responder for per category search
|
||||||
const categoryMatch = request.url.match(/category_id=([0-9]+)/);
|
const categoryMatch = request.url.match(/category_id=([0-9]+)/);
|
||||||
if (categoryMatch) {
|
if (categoryMatch) {
|
||||||
if(categoryMatch[1] === "3"){
|
if (categoryMatch[1] === "3") {
|
||||||
return response({});
|
return response({});
|
||||||
}
|
}
|
||||||
return response({
|
return response({
|
||||||
@ -24,11 +23,12 @@ QUnit.module("lib:user-search", {
|
|||||||
avatar_template:
|
avatar_template:
|
||||||
"https://avatars.discourse.org/v3/letter/t/41988e/{size}.png"
|
"https://avatars.discourse.org/v3/letter/t/41988e/{size}.png"
|
||||||
}
|
}
|
||||||
]});
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(request.url.match(/no-results/)){
|
if (request.url.match(/no-results/)) {
|
||||||
return response({users: []});
|
return response({ users: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
return response({
|
return response({
|
||||||
|
@ -2,6 +2,7 @@ import Post from "discourse/models/post";
|
|||||||
import createStore from "helpers/create-store";
|
import createStore from "helpers/create-store";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
import pretender from "helpers/create-pretender";
|
||||||
|
|
||||||
QUnit.module("model:post-stream");
|
QUnit.module("model:post-stream");
|
||||||
|
|
||||||
@ -753,8 +754,7 @@ QUnit.test("triggerRecoveredPost", async assert => {
|
|||||||
return [200, { "Content-Type": "application/json" }, object];
|
return [200, { "Content-Type": "application/json" }, object];
|
||||||
};
|
};
|
||||||
|
|
||||||
// prettier-ignore
|
pretender.get("/posts/4", () => {
|
||||||
server.get("/posts/4", () => { // eslint-disable-line no-undef
|
|
||||||
return response({ id: 4, post_number: 4 });
|
return response({ id: 4, post_number: 4 });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/*global document, sinon, QUnit, Logster */
|
/*global document, sinon, QUnit, Logster */
|
||||||
|
|
||||||
//= require env
|
//= require env
|
||||||
//= require jquery.debug
|
//= require jquery.debug
|
||||||
//= require jquery.ui.widget
|
//= require jquery.ui.widget
|
||||||
@ -77,7 +76,7 @@ if (window.Logster) {
|
|||||||
window.Logster = { enabled: false };
|
window.Logster = { enabled: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
var pretender = require("helpers/create-pretender", null, null, false),
|
var createPretender = require("helpers/create-pretender", null, null, false),
|
||||||
fixtures = require("fixtures/site-fixtures", null, null, false).default,
|
fixtures = require("fixtures/site-fixtures", null, null, false).default,
|
||||||
flushMap = require("discourse/models/store", null, null, false).flushMap,
|
flushMap = require("discourse/models/store", null, null, false).flushMap,
|
||||||
ScrollingDOMMethods = require("discourse/mixins/scrolling", null, null, false)
|
ScrollingDOMMethods = require("discourse/mixins/scrolling", null, null, false)
|
||||||
@ -102,13 +101,32 @@ function resetSite(siteSettings, extras) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QUnit.testStart(function(ctx) {
|
QUnit.testStart(function(ctx) {
|
||||||
server = pretender.default();
|
server = createPretender.default;
|
||||||
|
createPretender.applyDefaultHandlers(server);
|
||||||
|
server.handlers = []
|
||||||
|
|
||||||
|
server.prepareBody = function(body) {
|
||||||
|
if (body && typeof body === "object") {
|
||||||
|
return JSON.stringify(body);
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
server.unhandledRequest = function(verb, path) {
|
||||||
|
const error =
|
||||||
|
"Unhandled request in test environment: " + path + " (" + verb + ")";
|
||||||
|
window.console.error(error);
|
||||||
|
throw error;
|
||||||
|
};
|
||||||
|
|
||||||
|
server.checkPassthrough = request =>
|
||||||
|
request.requestHeaders["Discourse-Script"];
|
||||||
|
|
||||||
if (ctx.module.startsWith(acceptanceModulePrefix)) {
|
if (ctx.module.startsWith(acceptanceModulePrefix)) {
|
||||||
var helper = {
|
var helper = {
|
||||||
parsePostData: pretender.parsePostData,
|
parsePostData: createPretender.parsePostData,
|
||||||
response: pretender.response,
|
response: createPretender.response,
|
||||||
success: pretender.success
|
success: createPretender.success
|
||||||
};
|
};
|
||||||
|
|
||||||
applyPretender(
|
applyPretender(
|
||||||
@ -153,10 +171,6 @@ QUnit.testDone(function() {
|
|||||||
$(".modal-backdrop").remove();
|
$(".modal-backdrop").remove();
|
||||||
flushMap();
|
flushMap();
|
||||||
|
|
||||||
server.shutdown();
|
|
||||||
|
|
||||||
window.server = null;
|
|
||||||
|
|
||||||
// ensures any event not removed is not leaking between tests
|
// ensures any event not removed is not leaking between tests
|
||||||
// most likely in intialisers, other places (controller, component...)
|
// most likely in intialisers, other places (controller, component...)
|
||||||
// should be fixed in code
|
// should be fixed in code
|
||||||
|
Reference in New Issue
Block a user