Skip to content

Commit

Permalink
chore: add a new test for a specific use case
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosabot committed Sep 5, 2024
1 parent 8542735 commit 14fd529
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/evaluteConfig-helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,34 @@ describe("Given the evaluateConfig function", () => {
});
});
});

describe("When we evaluate an object access", () => {
it("should render the value of the object", () => {
const variables = [];
const templateConfig = {
card: {
title_javascript: "('[[testing]]').text",
type: "custom:mushroom-title-card",
},
default: [
{
testing: {
text: "hello",
},
},
],
};

const hass = {
states: {},
};

const result = evaluateConfig(templateConfig, variables, hass);

expect(result).toEqual({
title: "hello",
type: "custom:mushroom-title-card",
});
});
});
});

0 comments on commit 14fd529

Please sign in to comment.