@uploadista/server 0.0.13-beta.4 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,43 +4,76 @@
4
4
  * These tests verify runtime plugin validation behavior.
5
5
  */
6
6
 
7
- import { Layer } from "effect";
7
+ import {
8
+ type DescribeVideoMetadata,
9
+ type ExtractFrameVideoParams,
10
+ ImagePlugin,
11
+ type OptimizeParams,
12
+ type ResizeParams,
13
+ type ResizeVideoParams,
14
+ type TranscodeVideoParams,
15
+ type Transformation,
16
+ type TrimVideoParams,
17
+ type UploadistaError,
18
+ VideoPlugin,
19
+ type ZipInput,
20
+ type ZipParams,
21
+ ZipPlugin,
22
+ } from "@uploadista/core";
23
+ import { Effect, Layer } from "effect";
8
24
  import { describe, expect, it } from "vitest";
9
25
  import {
10
26
  extractServiceIdentifiers,
11
27
  formatPluginValidationError,
12
28
  validatePluginRequirements,
13
29
  validatePluginsOrThrow,
14
- } from "../plugin-validation";
30
+ } from "../../src/core/plugin-validation";
15
31
 
16
32
  // ============================================================================
17
33
  // Test Fixtures
18
34
  // ============================================================================
19
35
 
20
- class TestImagePlugin {
21
- readonly _tag = "ImagePlugin";
22
- resize(data: Buffer, width: number): Buffer {
23
- return data;
24
- }
25
- }
26
-
27
- class TestZipPlugin {
28
- readonly _tag = "ZipPlugin";
29
- compress(files: Buffer[]): Buffer {
30
- return Buffer.from([]);
31
- }
32
- }
33
-
34
- class TestVideoPlugin {
35
- readonly _tag = "VideoPlugin";
36
- transcode(data: Buffer): Buffer {
37
- return data;
38
- }
39
- }
40
-
41
- const imagePluginLayer = Layer.succeed(TestImagePlugin, new TestImagePlugin());
42
- const zipPluginLayer = Layer.succeed(TestZipPlugin, new TestZipPlugin());
43
- const videoPluginLayer = Layer.succeed(TestVideoPlugin, new TestVideoPlugin());
36
+ // Create test layers
37
+ const imagePluginLayer = Layer.succeed(
38
+ ImagePlugin,
39
+ ImagePlugin.of({
40
+ optimize: (input: Uint8Array, _options: OptimizeParams) =>
41
+ Effect.succeed(input),
42
+ resize: (input: Uint8Array, _options: ResizeParams) =>
43
+ Effect.succeed(input),
44
+ transform: (input: Uint8Array, _options: Transformation) =>
45
+ Effect.succeed(input),
46
+ }),
47
+ );
48
+ const zipPluginLayer = Layer.succeed(
49
+ ZipPlugin,
50
+ ZipPlugin.of({
51
+ zip: (_inputs: ZipInput[], _options: ZipParams) =>
52
+ Effect.succeed(new Uint8Array([])),
53
+ }),
54
+ );
55
+ const videoPluginLayer = Layer.succeed(
56
+ VideoPlugin,
57
+ VideoPlugin.of({
58
+ transcode: (input: Uint8Array, _options: TranscodeVideoParams) =>
59
+ Effect.succeed(input),
60
+ resize: (input: Uint8Array, _options: ResizeVideoParams) =>
61
+ Effect.succeed(input),
62
+ trim: (input: Uint8Array, _options: TrimVideoParams) =>
63
+ Effect.succeed(input),
64
+ extractFrame: (
65
+ _input: Uint8Array,
66
+ _options: ExtractFrameVideoParams,
67
+ ): Effect.Effect<Uint8Array, UploadistaError> => {
68
+ throw new Error("Function not implemented.");
69
+ },
70
+ describe: (
71
+ _input: Uint8Array,
72
+ ): Effect.Effect<DescribeVideoMetadata, UploadistaError> => {
73
+ throw new Error("Function not implemented.");
74
+ },
75
+ }),
76
+ );
44
77
 
45
78
  // ============================================================================
46
79
  // extractServiceIdentifiers Tests