Skip to content

Commit

Permalink
tests: enhance defineWrakerAppPlugin tests to check for extended prop…
Browse files Browse the repository at this point in the history
…erties
  • Loading branch information
josselinonduty committed Sep 28, 2024
1 parent 541a19e commit 7c2db2d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/tests/integration/runtime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it } from "vitest";
import {
defineWrakerApp,
defineWrakerAppPlugin,
Expand All @@ -16,17 +16,28 @@ describe("defineWrakerApp", () => {

describe("defineWrakerAppPlugin", () => {
it("should return a new instance of WrakerAppPluginFactory", () => {
const factory = defineWrakerAppPlugin({
const factory = defineWrakerAppPlugin<
{ test: number },
{ initial: number }
>({
name: "test",
description: "Test plugin",
version: "1.0.0",
init: vi.fn(),
destroy: vi.fn(),
init: (app, options) => {
if (!options) return;

app.test = options.initial;
},
});

expect(factory).toBeDefined();
expect(factory).toBeInstanceOf(Function);

expect(factory()).toBeDefined();

const app = defineWrakerApp({
plugins: [factory({ initial: 1 })],
});

expect(app.test).toBe(1);
});
});

0 comments on commit 7c2db2d

Please sign in to comment.