From eb3f18ff5ef613d84b0bb06173946fad8b55e5b2 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Tue, 3 Oct 2023 09:57:40 +0200 Subject: [PATCH] [FIX] web: patch date in object test Before this commit, a test in the "objects" test suite failed because it used native dates without patching them, resulting in a low chance of the generated dates to vary by 1 millisecond and failing the assertions. This commit patches dates in that test to avoid this issue. RunBot task 23058 closes odoo/odoo#137426 X-original-commit: aebbbaf942b85cb4d141975a617d8bcadfe9a719 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/tests/core/utils/objects_tests.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/static/tests/core/utils/objects_tests.js b/addons/web/static/tests/core/utils/objects_tests.js index 00c920f2edd..f0f6f42cee5 100644 --- a/addons/web/static/tests/core/utils/objects_tests.js +++ b/addons/web/static/tests/core/utils/objects_tests.js @@ -1,6 +1,7 @@ /** @odoo-module **/ import { omit, pick, shallowEqual } from "@web/core/utils/objects"; +import { patchDate } from "@web/../tests/helpers/utils"; QUnit.module("utils", () => { QUnit.module("Objects"); @@ -59,6 +60,8 @@ QUnit.module("utils", () => { }); QUnit.test("shallowEqual: custom comparison function", function (assert) { + patchDate(2019, 2, 11, 12, 30, 0); + assert.notOk(shallowEqual({ a: 1, date: new Date() }, { a: 1, date: new Date() })); assert.ok( shallowEqual({ a: 1, date: new Date() }, { a: 1, date: new Date() }, (a, b) =>