From 64de1f292c2cb38df94e4b46789cf35307a734c7 Mon Sep 17 00:00:00 2001 From: javierbrea Date: Sun, 11 Sep 2022 08:04:41 +0200 Subject: [PATCH] test: Fix core E2E tests --- test/core-e2e/src/plugins.spec.js | 13 ++++++------- test/core-e2e/src/support/helpers.js | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/core-e2e/src/plugins.spec.js b/test/core-e2e/src/plugins.spec.js index 85eb43cf7..9388f16bc 100644 --- a/test/core-e2e/src/plugins.spec.js +++ b/test/core-e2e/src/plugins.spec.js @@ -11,8 +11,7 @@ Unless required by applicable law or agreed to in writing, software distributed const sinon = require("sinon"); const express = require("express"); -const filterPluginAlerts = (alerts) => - alerts.filter((alert) => alert.context.indexOf("plugins") === 0); +const filterPluginAlerts = (alerts) => alerts.filter((alert) => alert.id.indexOf("plugins") === 0); const filterLogs = (logs, text) => logs.filter((log) => log.includes(text)); @@ -138,10 +137,10 @@ describe("plugins", () => { it("should have added two plugin alerts", async () => { const alerts = filterPluginAlerts(core.alerts.flat); const registerAlert = alerts.find( - (alert) => alert.context === "plugins:test-plugin:test-register" + (alert) => alert.id === "plugins:test-plugin:test-register" ); const startAlert = alerts.find( - (alert) => alert.context === "plugins:test-plugin:test-start" + (alert) => alert.id === "plugins:test-plugin:test-start" ); expect(alerts.length).toEqual(2); expect(registerAlert.message).toEqual("Warning registering plugin"); @@ -151,12 +150,12 @@ describe("plugins", () => { it("should have added three plugin alerts", async () => { const alerts = filterPluginAlerts(core.alerts.flat); const registerAlert = alerts.find( - (alert) => alert.context === "plugins:test-plugin:test-register" + (alert) => alert.id === "plugins:test-plugin:test-register" ); const startAlert = alerts.find( - (alert) => alert.context === "plugins:test-plugin:test-start" + (alert) => alert.id === "plugins:test-plugin:test-start" ); - const idAlert = alerts.find((alert) => alert.context === "plugins:format:0"); + const idAlert = alerts.find((alert) => alert.id === "plugins:format:0"); expect(alerts.length).toEqual(3); expect(registerAlert.message).toEqual("Warning registering plugin"); expect(idAlert.message).toEqual("Plugins must have a static id property"); diff --git a/test/core-e2e/src/support/helpers.js b/test/core-e2e/src/support/helpers.js index 0f12d33f4..768773aab 100644 --- a/test/core-e2e/src/support/helpers.js +++ b/test/core-e2e/src/support/helpers.js @@ -163,11 +163,11 @@ const mocksRunner = (args = [], options = {}) => { }; const filterAlerts = (alertContextFragment, alerts) => { - return alerts.filter((alert) => alert.context.includes(alertContextFragment)); + return alerts.filter((alert) => alert.id.includes(alertContextFragment)); }; const findAlert = (alertContextFragment, alerts) => { - return alerts.find((alert) => alert.context.includes(alertContextFragment)); + return alerts.find((alert) => alert.id.includes(alertContextFragment)); }; const findTrace = (traceFragment, traces) => {