-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update compliments module #3471
Update compliments module #3471
Conversation
Add config option "specialDaysUnique". If set to true, only compliments configured for special days will be shown on those days. Default setting is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. sorry for moving the goalpost, but might you also be able to add a test for this to the mm tests?
Changes suggested by rejas after review Co-authored-by: Veeck <github@veeck.de>
I believe I have done what you ask @rejas. Obviously these tests rely on using the new compliments.js file so I assume tests are done against the develop branch? |
where are the actual tests for this PR? I don't see any update to the e2e or electron test scripts. |
i added my tests to the electron and e2e tests... but npm run test:??? unit/e2e/electron all show your test didn't run
but this is in both e2e and electron test suites
|
there are no tests in this PR only new config's |
I'm sorry but I've never used GitHub before and I can't find any documentation to explain how to test configs in the way you seem to expect. I looked in the tests folder and found example configs so I made mine in the same format and I tested them on my local install. All my commits are based on changes I have made on my live instance because I don't know any other way to do it and I wrote them into the appropriate file using the GitHub web interface (hence the repeated issues with spaces rather than tabs!). If there is guidance on how to contribute to the project with technical steps please point me to it. |
I don't expect writing tests if you are not experienced with this ...
... and we have no guide for writing tests at the moment. So @rejas can we proceed without tests to have the feature in the next release or other ideas? |
I have a testcase for compliments, I can add his.. BUT.. I have a failure.. says 'expects(" ") describe("Feature cron entry in compliments module", () => {
describe("Set date and empty compliments for anytime, morning, evening and afternoon", () => {
it("shows 'just pub time' compliment on friday, between 16:00 and 19:10, between 00-10 minutes after the hour, only on fridays", async () => {
await helpers.startApplication("tests/configs/modules/compliments/compliments_cron_entry.js"); //, "06 May 2022 17:03:00 GMT"
await helpers.getDocument();
await expect(doTest(["just pub time"])).resolves.toBe(true);
});
});
}); from the e2e test
why? |
I fear I am becoming unqualified to add to this discussion but I have double-checked that my local files match those in the commit and I have retested locally and MM is working as I had expected:
I am also using the altered compliments.js file from the commit. Sorry if this is becoming burdensome. |
@WallysWellies npm run test:unit because the files out there are supposed to be the test script, not the config for the test and there are three kinds of testcases unit,,, - for when a module has sub-parts that return data to higher parts.. weather and calendar are like that i just discovered this yesterday, cause I haven't built any testcases before.. made a lot of changes, but all before testing so you would move your two config.js files from the unit tree to the configs tree |
SO.. I want to do the test as a false result, BUT this in the test process does NOT return false, it rejects expect(complimentsArray).toContain(await elem.textContent()); and the test was await expect(doTest(["Special day message"])).resolves.toBe(false); get
i don't KNOW what the answer WILL be as its random.. I know it SHOULD NOT be 'Special day message'.. how do I fix this?.. I don't know the test language at all. |
Will thinking about this, I dont think a test case is doable, since we present the compliments at random. So we cannot really check if the special-day message is shown exclusively or not... So maybe we skip tests for this for now ? |
I will present a test for this later or tomorrow |
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") { module.exports = config; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now youre just missing some actual test cases in the tests/e2e/modules/compliments_spec.js file, which load these configs and check the output of the MagicMirror
Thanks @WallysWellies (and @khassel of course) for your work and your patience! |
I appreciate all your assistance and patience with me! It's been an experience dipping my toes into the world of Git and seeing how it's done. I've enjoyed making my small contribution to the project. |
certainly for the positive/true test, ss only the special day message will
occur. that the new field.
the negative/false pass is the trouble.
…On Mon, Jun 24, 2024, 3:04 PM Veeck ***@***.***> wrote:
Will thinking about this, I dont think a test case is doable, since we
present the compliments at random. So we cannot really check if the
special-day message is shown exclusively or not... So maybe we skip tests
for this for now ?
—
Reply to this email directly, view it on GitHub
<#3471 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALNYHVGAOK3EZUU6VL66G3ZJB3U5AVCNFSM6AAAAABJODNVNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBXGMYTCOJUHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
actually the negative could have ALL the choices to test against as positive. so any random result will work |
actually that works describe("Feature new parm for date events in compliments module", () => {
describe("Set date and compliments for anytime, morning, evening and afternoon and one value for date", () => {
it("may show only date event on friday with new parm ", async () => {
await helpers.startApplication("tests/configs/modules/compliments/compliments_specialDayUnique_false.js", "06 May 2022 14:03:00 GMT");
await expect(doTest(["Special day message","Typical message 1","Typical message 2","Typical message 3"])).resolves.toBe(true);
});
});
}); |
Fixes #3465
Add config option
specialDayUnique
that defaults tofalse
and causes special day compliments to be added to the existing compliments array. Setting this option totrue
will only show the compliments that have been configured for that day.