DEV: Fix linting issue and failing post test (#29989)

This commit is contained in:
Sérgio Saquetim 2024-11-28 18:13:32 -03:00 committed by GitHub
parent d3595b6118
commit 4cfc350b09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,7 @@ function trackedPostProperty(target, propertyKey, descriptor) {
export default class Post extends RestModel {
static munge(json) {
json.likeAction = null;
json.likeAction ??= null;
if (json.actions_summary) {
const lookup = EmberObject.create();

View File

@ -43,6 +43,12 @@ module("Unit | Model | post", function (hooks) {
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(
this.store.createRecord("post", {
raw: "different raw",
@ -131,6 +137,6 @@ module("Unit | Model | post", function (hooks) {
id: 1173,
});
assert.ok(post.likeAction === null, "likeAction was reset to null");
assert.strictEqual(post.likeAction, null, "likeAction was reset to null");
});
});