Skip to content

Commit 8dd782b

Browse files
committed
add tests
1 parent 0bd54d1 commit 8dd782b

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
import { EsbuildPlugin } from "unplugin";
12
import { sentryEsbuildPlugin } from "../src";
23

34
test("Esbuild plugin should exist", () => {
45
expect(sentryEsbuildPlugin).toBeDefined();
56
expect(typeof sentryEsbuildPlugin).toBe("function");
67
});
8+
9+
describe("sentryEsbuildPlugin", () => {
10+
it("returns an esbuild plugin", () => {
11+
const plugins = sentryEsbuildPlugin({
12+
authToken: "test-token",
13+
org: "test-org",
14+
project: "test-project",
15+
}) as EsbuildPlugin;
16+
17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18+
expect(plugins).toEqual({ name: "unplugin-host-0", setup: expect.any(Function) });
19+
});
20+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1+
import { Plugin } from "rollup";
12
import { sentryRollupPlugin } from "../src";
23

34
test("Rollup plugin should exist", () => {
45
expect(sentryRollupPlugin).toBeDefined();
56
expect(typeof sentryRollupPlugin).toBe("function");
67
});
8+
9+
describe("sentryRollupPlugin", () => {
10+
it("returns an array of rollup plugins", () => {
11+
const plugins = sentryRollupPlugin({
12+
authToken: "test-token",
13+
org: "test-org",
14+
project: "test-project",
15+
}) as Plugin[];
16+
17+
expect(Array.isArray(plugins)).toBe(true);
18+
19+
const pluginNames = plugins.map((plugin) => plugin.name);
20+
21+
expect(pluginNames).toEqual([
22+
"sentry-telemetry-plugin",
23+
"sentry-rollup-release-injection-plugin",
24+
"sentry-release-management-plugin",
25+
"sentry-rollup-debug-id-injection-plugin",
26+
"sentry-rollup-debug-id-upload-plugin",
27+
"sentry-file-deletion-plugin",
28+
]);
29+
});
30+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
1+
import { VitePlugin } from "unplugin";
12
import { sentryVitePlugin } from "../src";
23

34
test("Vite plugin should exist", () => {
45
expect(sentryVitePlugin).toBeDefined();
56
expect(typeof sentryVitePlugin).toBe("function");
67
});
8+
9+
describe("sentryVitePlugin", () => {
10+
it("returns an array of Vite plugins", () => {
11+
const plugins = sentryVitePlugin({
12+
authToken: "test-token",
13+
org: "test-org",
14+
project: "test-project",
15+
}) as VitePlugin[];
16+
17+
expect(Array.isArray(plugins)).toBe(true);
18+
19+
const pluginNames = plugins.map((plugin) => plugin.name);
20+
21+
expect(pluginNames).toEqual([
22+
"sentry-telemetry-plugin",
23+
"sentry-vite-release-injection-plugin",
24+
"sentry-release-management-plugin",
25+
"sentry-vite-debug-id-injection-plugin",
26+
"sentry-vite-debug-id-upload-plugin",
27+
"sentry-file-deletion-plugin",
28+
]);
29+
});
30+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
import { Plugin } from "webpack";
12
import { sentryWebpackPlugin } from "../src";
23

34
test("Webpack plugin should exist", () => {
45
expect(sentryWebpackPlugin).toBeDefined();
56
expect(typeof sentryWebpackPlugin).toBe("function");
67
});
8+
9+
describe("sentryWebpackPlugin", () => {
10+
it("returns a webpack plugin", () => {
11+
const plugin = sentryWebpackPlugin({
12+
authToken: "test-token",
13+
org: "test-org",
14+
project: "test-project",
15+
}) as Plugin;
16+
17+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18+
expect(plugin).toEqual({ apply: expect.any(Function) });
19+
});
20+
});

0 commit comments

Comments
 (0)