Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thorrester committed Oct 11, 2024
1 parent 221a079 commit 9b83d47
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ export async function load({ url }) {

const alertMetricVizData = createAlertMetricViz(alertMetrics);

console.log("hello");

return {
repository: repository,
name: name,
Expand Down
44 changes: 33 additions & 11 deletions opsml/app/static/src/tests/+model_monitoring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@ import {
} from "./constants";
import {
type DriftValues,
ProfileType,
type SpcFeatureDriftProfile,
TimeWindow,
type AlertMetrics,
} from "$lib/scripts/types";
import MonitoringPage from "../routes/opsml/model/card/monitoring/feature/+page.svelte";
import {
createAlertMetricViz,
createSpcDriftViz,
createSpcFeatureDistributionViz,
} from "$lib/scripts/monitoring/utils";
import type { MonitorData } from "$lib/scripts/monitoring/types";

beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

it("render Scouter Monitoring Page", () => {
it("render Scouter Monitoring Page", async () => {
let driftprofiles = new Map();
driftprofiles["SPC"] = SpcDriftProfile;

Expand All @@ -32,7 +36,7 @@ it("render Scouter Monitoring Page", () => {
let featureProfile: SpcFeatureDriftProfile = SpcDriftProfile.features["col1"];

let driftVizData = createSpcDriftViz(driftValues, featureProfile);
let featureDistVizData = createSpcFeatureDistributionViz(
let featureDistVizData = await createSpcFeatureDistributionViz(
"repository",
"model",
"0.1.0",
Expand All @@ -42,21 +46,39 @@ it("render Scouter Monitoring Page", () => {
featureProfile
);

const data = {
driftprofiles: driftprofiles,
targetFeature:
SpcDriftProfile.features[Object.keys(SpcDriftProfile.features)[0]],
features: Object.keys(SpcDriftProfile.features),
let alertMetrics: AlertMetrics = {
created_at: ["2021-08-10T00:00:00Z"],
acknowledged: [0],
active: [0],
alert_count: [0],
};

let alertMetricVizData = createAlertMetricViz(alertMetrics);

let vizData = {
driftVizData: driftVizData,
featureDistVizData: featureDistVizData,
timeWindow: TimeWindow.TwentyFourHours,
max_data_points: 1000,
};

let monitorData: MonitorData = {
vizData,
feature: SpcDriftProfile.features["col1"],
};

const data = {
name: "model-1",
repository: "ml-platform-1",
version: "0.1.0",
alerts: exampleAlerts,
feature: "col1",
type: ProfileType.SPC,
driftprofiles,
showConfig: false,
profileType: "SPC",
timeWindow: "24h",
alerts: exampleAlerts,
alertMetricVizData,
max_data_points: 1000,
targetFeature: SpcDriftProfile.features["col1"],
monitorData,
};
render(MonitoringPage, { data });
});

0 comments on commit 9b83d47

Please sign in to comment.