DEV: Fix a leaky test (#13559)
The error was: ``` ↪ Unit | Model | topic::recover [✔] ↪ Unit | Utility | emoji::emojiUnescape [✔] ↪ Unit | Utility | pretty-text::quoting a quote [✔] ↪ Unit | Utility | click-track::routes to internal urlsUnhandled request in test environment: /forum/t/1234/recover (PUT) Error: Unhandled request in test environment: /forum/t/1234/recover (PUT) at Pretender.server.unhandledRequest (discourse/tests/setup-tests:173:15) at Pretender.handleRequest (pretender:400:14) at FakeRequest.send (pretender:169:21) at Object.send (jquery:10100:10) at Function.ajax (jquery:9683:15) at performAjax (discourse/app/lib/ajax:174:19) at eval (discourse/app/lib/ajax:183:11) at invokeCallback (ember:63104:17) at publish (ember:63087:9) at eval (ember:57463:16) [✘] ``` * DEV: Don't duplicate a function
This commit is contained in:
parent
d098f51ad3
commit
5af0636d83
|
@ -6,7 +6,7 @@ import { isEmpty, isPresent } from "@ember/utils";
|
|||
import { later, next, schedule } from "@ember/runloop";
|
||||
import { AUTO_DELETE_PREFERENCES } from "discourse/models/bookmark";
|
||||
import Composer from "discourse/models/composer";
|
||||
import EmberObject from "@ember/object";
|
||||
import EmberObject, { action } from "@ember/object";
|
||||
import I18n from "I18n";
|
||||
import Post from "discourse/models/post";
|
||||
import { Promise } from "rsvp";
|
||||
|
@ -949,10 +949,6 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
});
|
||||
},
|
||||
|
||||
recoverTopic() {
|
||||
this.model.recover();
|
||||
},
|
||||
|
||||
makeBanner() {
|
||||
this.model.makeBanner();
|
||||
},
|
||||
|
@ -1424,6 +1420,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
return spinnerHTML;
|
||||
},
|
||||
|
||||
@action
|
||||
recoverTopic() {
|
||||
this.model.recover();
|
||||
},
|
||||
|
|
|
@ -109,7 +109,7 @@ discourseModule("Unit | Model | topic", function () {
|
|||
assert.equal(topic.get("category"), category);
|
||||
});
|
||||
|
||||
test("recover", function (assert) {
|
||||
test("recover", async function (assert) {
|
||||
const user = User.create({ username: "eviltrout" });
|
||||
const topic = Topic.create({
|
||||
id: 1234,
|
||||
|
@ -117,7 +117,8 @@ discourseModule("Unit | Model | topic", function () {
|
|||
deleted_by: user,
|
||||
});
|
||||
|
||||
topic.recover();
|
||||
await topic.recover();
|
||||
|
||||
assert.blank(topic.get("deleted_at"), "it clears deleted_at");
|
||||
assert.blank(topic.get("deleted_by"), "it clears deleted_by");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue