mirror of
				https://github.com/MichMich/MagicMirror.git
				synced 2025-10-31 02:36:47 +00:00 
			
		
		
		
	chore: update dependencies (#3891)
Since receiving a security warning about `axios` in `node-ical` (https://github.com/MagicMirrorOrg/MagicMirror/security/dependabot/70), I've created [a pull request to remove `axios` from `node-ical`](https://github.com/jens-maus/node-ical/pull/397) — it was accepted and we now have a new version 🙂
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							fb2aa438d8
						
					
				
				
					commit
					777b49c566
				
			| @@ -1,43 +1,79 @@ | ||||
| const helpers = require("./helpers/global-setup"); | ||||
|  | ||||
| // Validate Animate.css integration for compliments module using class toggling. | ||||
| // We intentionally ignore computed animation styles (jsdom doesn't simulate real animations). | ||||
| describe("AnimateCSS integration Test", () => { | ||||
| 	// define config file for testing | ||||
| 	let testConfigFile = "tests/configs/modules/compliments/compliments_animateCSS.js"; | ||||
| 	// define config file to fallback to default: wrong animation name (must return no animation) | ||||
| 	let testConfigFileFallbackToDefault = "tests/configs/modules/compliments/compliments_animateCSS_fallbackToDefault.js"; | ||||
| 	// define config file with an inverted name animation : in for out and vice versa (must return no animation) | ||||
| 	let testConfigFileInvertedAnimationName = "tests/configs/modules/compliments/compliments_animateCSS_invertedAnimationName.js"; | ||||
| 	// define config file with no animation defined | ||||
| 	let testConfigByDefault = "tests/configs/modules/compliments/compliments_anytime.js"; | ||||
| 	// Config variants under test | ||||
| 	const TEST_CONFIG_ANIM = "tests/configs/modules/compliments/compliments_animateCSS.js"; | ||||
| 	const TEST_CONFIG_FALLBACK = "tests/configs/modules/compliments/compliments_animateCSS_fallbackToDefault.js"; // invalid animation names | ||||
| 	const TEST_CONFIG_INVERTED = "tests/configs/modules/compliments/compliments_animateCSS_invertedAnimationName.js"; // in/out swapped | ||||
| 	const TEST_CONFIG_NONE = "tests/configs/modules/compliments/compliments_anytime.js"; // no animations defined | ||||
|  | ||||
| 	/** | ||||
| 	 * move similar tests in function doTest | ||||
| 	 * @param {string} [animationIn] animation in name of AnimateCSS to test. | ||||
| 	 * @param {string} [animationOut] animation out name of AnimateCSS to test. | ||||
| 	 * @returns {boolean} result | ||||
| 	 * Get the compliments container element (waits until available). | ||||
| 	 * @returns {Promise<HTMLElement>} compliments root element | ||||
| 	 */ | ||||
| 	const doTest = async (animationIn, animationOut) => { | ||||
| 	async function getComplimentsElement () { | ||||
| 		await helpers.getDocument(); | ||||
| 		let elem = await helpers.waitForElement(".compliments"); | ||||
| 		expect(elem).not.toBeNull(); | ||||
| 		let styles = window.getComputedStyle(elem); | ||||
| 		const el = await helpers.waitForElement(".compliments"); | ||||
| 		expect(el).not.toBeNull(); | ||||
| 		return el; | ||||
| 	} | ||||
|  | ||||
| 		if (animationIn && animationIn !== "") { | ||||
| 			expect(styles._values.get("animation-name")).toBe(animationIn); | ||||
| 		} else { | ||||
| 			expect(styles._values.get("animation-name")).toBeUndefined(); | ||||
| 	/** | ||||
| 	 * Wait for an Animate.css class to appear and persist briefly. | ||||
| 	 * @param {string} cls Animation class name without leading dot (e.g. animate__flipInX) | ||||
| 	 * @param {{timeout?: number}} [options] Poll timeout in ms (default 6000) | ||||
| 	 * @returns {Promise<boolean>} true if class detected in time | ||||
| 	 */ | ||||
| 	async function waitForAnimationClass (cls, { timeout = 6000 } = {}) { | ||||
| 		const start = Date.now(); | ||||
| 		while (Date.now() - start < timeout) { | ||||
| 			if (document.querySelector(`.compliments.animate__animated.${cls}`)) { | ||||
| 				// small stability wait | ||||
| 				await new Promise((r) => setTimeout(r, 50)); | ||||
| 				if (document.querySelector(`.compliments.animate__animated.${cls}`)) return true; | ||||
| 			} | ||||
| 			await new Promise((r) => setTimeout(r, 100)); | ||||
| 		} | ||||
| 		throw new Error(`Timeout waiting for class ${cls}`); | ||||
| 	} | ||||
|  | ||||
| 		if (animationOut && animationOut !== "") { | ||||
| 			elem = await helpers.waitForElement(`.compliments.animate__animated.animate__${animationOut}`); | ||||
| 			expect(elem).not.toBeNull(); | ||||
| 			styles = window.getComputedStyle(elem); | ||||
| 			expect(styles._values.get("animation-name")).toBe(animationOut); | ||||
| 		} else { | ||||
| 			expect(styles._values.get("animation-name")).toBeUndefined(); | ||||
| 	/** | ||||
| 	 * Assert that no Animate.css animation class is applied within a time window. | ||||
| 	 * @param {number} [ms] Observation period in ms (default 2000) | ||||
| 	 * @returns {Promise<void>} | ||||
| 	 */ | ||||
| 	async function assertNoAnimationWithin (ms = 2000) { | ||||
| 		const start = Date.now(); | ||||
| 		while (Date.now() - start < ms) { | ||||
| 			if (document.querySelector(".compliments.animate__animated")) { | ||||
| 				throw new Error("Unexpected animate__animated class present in non-animation scenario"); | ||||
| 			} | ||||
| 			await new Promise((r) => setTimeout(r, 100)); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Run one animation test scenario. | ||||
| 	 * @param {string} [animationIn] Expected animate-in name | ||||
| 	 * @param {string} [animationOut] Expected animate-out name | ||||
| 	 * @returns {Promise<boolean>} true when scenario assertions pass | ||||
| 	 */ | ||||
| 	async function runAnimationTest (animationIn, animationOut) { | ||||
| 		await getComplimentsElement(); | ||||
| 		if (!animationIn && !animationOut) { | ||||
| 			await assertNoAnimationWithin(2000); | ||||
| 			return true; | ||||
| 		} | ||||
| 		if (animationIn) await waitForAnimationClass(`animate__${animationIn}`); | ||||
| 		if (animationOut) { | ||||
| 			// Wait just beyond one update cycle (updateInterval=2000ms) before expecting animateOut. | ||||
| 			await new Promise((r) => setTimeout(r, 2100)); | ||||
| 			await waitForAnimationClass(`animate__${animationOut}`); | ||||
| 		} | ||||
| 		return true; | ||||
| 	}; | ||||
| 	} | ||||
|  | ||||
| 	afterEach(async () => { | ||||
| 		await helpers.stopApplication(); | ||||
| @@ -45,29 +81,29 @@ describe("AnimateCSS integration Test", () => { | ||||
|  | ||||
| 	describe("animateIn and animateOut Test", () => { | ||||
| 		it("with flipInX and flipOutX animation", async () => { | ||||
| 			await helpers.startApplication(testConfigFile); | ||||
| 			await expect(doTest("flipInX", "flipOutX")).resolves.toBe(true); | ||||
| 			await helpers.startApplication(TEST_CONFIG_ANIM); | ||||
| 			await expect(runAnimationTest("flipInX", "flipOutX")).resolves.toBe(true); | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	describe("use animateOut name for animateIn (vice versa) Test", () => { | ||||
| 		it("without animation", async () => { | ||||
| 			await helpers.startApplication(testConfigFileInvertedAnimationName); | ||||
| 			await expect(doTest()).resolves.toBe(true); | ||||
| 		it("without animation (inverted names)", async () => { | ||||
| 			await helpers.startApplication(TEST_CONFIG_INVERTED); | ||||
| 			await expect(runAnimationTest()).resolves.toBe(true); | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	describe("false Animation name test", () => { | ||||
| 		it("without animation", async () => { | ||||
| 			await helpers.startApplication(testConfigFileFallbackToDefault); | ||||
| 			await expect(doTest()).resolves.toBe(true); | ||||
| 		it("without animation (invalid names)", async () => { | ||||
| 			await helpers.startApplication(TEST_CONFIG_FALLBACK); | ||||
| 			await expect(runAnimationTest()).resolves.toBe(true); | ||||
| 		}); | ||||
| 	}); | ||||
|  | ||||
| 	describe("no Animation defined test", () => { | ||||
| 		it("without animation", async () => { | ||||
| 			await helpers.startApplication(testConfigByDefault); | ||||
| 			await expect(doTest()).resolves.toBe(true); | ||||
| 		it("without animation (no config)", async () => { | ||||
| 			await helpers.startApplication(TEST_CONFIG_NONE); | ||||
| 			await expect(runAnimationTest()).resolves.toBe(true); | ||||
| 		}); | ||||
| 	}); | ||||
| }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user