Skip to content

Commit

Permalink
test: Fix core E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbrea committed Sep 11, 2022
1 parent 69431cf commit 64de1f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions test/core-e2e/src/plugins.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions test/core-e2e/src/support/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 64de1f2

Please sign in to comment.