[FIX] web: missing action id warnings

* Add test name when logging missing action ids, makes finding out
  which test causes the issue much simpler.
* Suppress the warning emission in the one remaining test which
  triggers it, as testing invalid action IDs is exactly the purpose of
  the test.
This commit is contained in:
Xavier Morel
2021-06-29 05:34:16 +00:00
parent 46bc0b110e
commit 3985edd5da
3 changed files with 4 additions and 3 deletions
@@ -498,7 +498,7 @@ export class MockServer {
if (!action) {
// when the action doesn't exist, the real server doesn't crash, it
// simply returns false
console.warn("No action found for ID " + kwargs.action_id);
console.warn(`No action found for ID ${kwargs.action_id} during test ${QUnit.config.current.testName}`);
}
return action || false;
}
@@ -1160,7 +1160,7 @@ var MockServer = Class.extend({
if (!action) {
// when the action doesn't exist, the real server doesn't crash, it
// simply returns false
console.warn("No action found for ID " + kwargs.action_id);
console.warn(`No action found for ID ${kwargs.action_id} during test ${QUnit.config.current.testName} (legacy)`);
}
return action || false;
},
@@ -6,7 +6,7 @@ import core from "web.core";
import testUtils from "web.test_utils";
import Widget from "web.Widget";
import { makeTestEnv } from "../../helpers/mock_env";
import { legacyExtraNextTick, patchWithCleanup } from "../../helpers/utils";
import {hushConsole, legacyExtraNextTick, patchWithCleanup} from "../../helpers/utils";
import {
createWebClient,
doAction,
@@ -97,6 +97,7 @@ QUnit.module("ActionManager", (hooks) => {
QUnit.test("properly handle case when action id does not exist", async (assert) => {
assert.expect(2);
const webClient = await createWebClient({ serverData });
patchWithCleanup(window, {console: hushConsole}, {pure: true});
patchWithCleanup(webClient.env.services.notification, {
add(message) {
assert.strictEqual(message, "No action with id '4448' could be found");