mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 14:14:33 +08:00
DEV: Fix linting issue and failing post test (#29989)
This commit is contained in:
parent
d3595b6118
commit
4cfc350b09
@ -63,7 +63,7 @@ function trackedPostProperty(target, propertyKey, descriptor) {
|
|||||||
|
|
||||||
export default class Post extends RestModel {
|
export default class Post extends RestModel {
|
||||||
static munge(json) {
|
static munge(json) {
|
||||||
json.likeAction = null;
|
json.likeAction ??= null;
|
||||||
if (json.actions_summary) {
|
if (json.actions_summary) {
|
||||||
const lookup = EmberObject.create();
|
const lookup = EmberObject.create();
|
||||||
|
|
||||||
|
@ -43,6 +43,12 @@ module("Unit | Model | post", function (hooks) {
|
|||||||
likeAction: null, // `likeAction` is a tracked property from the model added using `@trackedPostProperty`
|
likeAction: null, // `likeAction` is a tracked property from the model added using `@trackedPostProperty`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// asserts that Object.keys(post) does not contain "likeAction"
|
||||||
|
assert.false(
|
||||||
|
Object.keys(post).includes("likeAction"),
|
||||||
|
"Object.keys does not enumerate `likeAction`"
|
||||||
|
);
|
||||||
|
|
||||||
post.updateFromPost(
|
post.updateFromPost(
|
||||||
this.store.createRecord("post", {
|
this.store.createRecord("post", {
|
||||||
raw: "different raw",
|
raw: "different raw",
|
||||||
@ -131,6 +137,6 @@ module("Unit | Model | post", function (hooks) {
|
|||||||
id: 1173,
|
id: 1173,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.ok(post.likeAction === null, "likeAction was reset to null");
|
assert.strictEqual(post.likeAction, null, "likeAction was reset to null");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user