test: Add unit tests for templateVarHandler to improve coverage#34963
test: Add unit tests for templateVarHandler to improve coverage#34963MatheussBrant wants to merge 2 commits intoRocketChat:developfrom
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
|
| }); | ||
| }; | ||
|
|
||
| describe('templateVarHandler', () => { |
There was a problem hiding this comment.
What do you think of, instead of creating a new describe for each item, you construct an array of "test cases" and then you loop on them to do the test?
Something like:
const tests = [{ variable: 'attribute1', object: { attribute1: 'value1' }, expected: 'value1' }]
describe('templateVarHandler', () => {
tests.forEach((t) => { it(`should return ${t.expected} when ${t.variable} is passed as key`, () => { expect(templateVarHandler(t.variable, t.object)).to.be.equal(t.expected) }
})
(I may have missed some () but wdyt?
|
Hey, thanks for contribution! Seems your linting settings are a bit off, as looks you're reducing the tabspace or you just have set your tab size too low. Wanna use eslint to fix those issues? You can run |
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments
Proposed Changes
This pull request introduces unit tests for the templateVarHandler function to improve test coverage and ensure correct behavior under different conditions.
Key Changes:
Screenshots (Coverage Changes):
Before:

After:
