mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
REFACTOR: Test Memory Usage Fixes (#7769)
* Calling `Discourse.reset()` creates a new container We should run our de-initializers only after acceptance tests, since initializers are not run outside of acceptance tests anyway, and the container at this point can be passed properly to the `teardown()` method. * Remove `Discourse.reset` from tests This would cause a new container to be created which leaks many objects. * `updateCurrentUser` is more accurate than `replaceCurrentUser`
This commit is contained in:

committed by
Joffrey JAFFEUX

parent
c3381b845b
commit
a8793d0d9a
@ -1,5 +1,5 @@
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
|
||||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Topic - Edit timer", {
|
||||
loggedIn: true,
|
||||
@ -20,7 +20,7 @@ acceptance("Topic - Edit timer", {
|
||||
});
|
||||
|
||||
QUnit.test("default", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@ -41,7 +41,7 @@ QUnit.test("default", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("autoclose - specific time", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
@ -62,7 +62,7 @@ QUnit.test("autoclose - specific time", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("autoclose", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
@ -117,7 +117,7 @@ QUnit.test("autoclose", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("close temporarily", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@ -159,7 +159,7 @@ QUnit.test("close temporarily", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("schedule", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const categoryChooser = selectKit(".modal-body .category-chooser");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
@ -194,7 +194,7 @@ QUnit.test("schedule", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("TL4 can't auto-delete", async assert => {
|
||||
replaceCurrentUser({ staff: false, trust_level: 4 });
|
||||
updateCurrentUser({ staff: false, trust_level: 4 });
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
await click(".toggle-admin-menu");
|
||||
@ -208,7 +208,7 @@ QUnit.test("TL4 can't auto-delete", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("auto delete", async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const timerType = selectKit(".select-kit.timer-type");
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
@ -238,7 +238,7 @@ QUnit.test("auto delete", async assert => {
|
||||
QUnit.test(
|
||||
"Manually closing before the timer will clear the status text",
|
||||
async assert => {
|
||||
replaceCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
updateCurrentUser({ admin: true, staff: true, canManageTopic: true });
|
||||
const futureDateInputSelector = selectKit(".future-date-input-selector");
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
|
Reference in New Issue
Block a user