@vnejs/plugins.views.screens.credits 0.1.17 → 0.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.views.screens.credits",
3
- "version": "0.1.17",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "tsconfig.json"
19
19
  ],
20
20
  "scripts": {
21
- "test": "echo \"Error: no test specified\" && exit 1",
21
+ "test": "npx @vnejs/monorepo test",
22
22
  "build": "npx @vnejs/monorepo package",
23
23
  "publish:major:plugin": "npm run publish:major",
24
24
  "publish:minor:plugin": "npm run publish:minor",
@@ -30,17 +30,26 @@
30
30
  "author": "",
31
31
  "license": "ISC",
32
32
  "dependencies": {
33
- "@vnejs/contracts.views.screens.credits": "~0.1.0"
33
+ "@vnejs/contracts.views.screens.credits": "~0.2.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@vnejs/helpers": "~0.1.0",
37
- "@vnejs/module.core": "~0.1.0",
38
- "@vnejs/module.components": "~0.1.0",
39
- "@vnejs/contracts.controls": "~0.1.0",
40
- "@vnejs/shared": "~0.1.0",
41
- "@vnejs/uis.react": "~0.1.0"
36
+ "@vnejs/helpers": "~0.2.0",
37
+ "@vnejs/module.core": "~0.2.0",
38
+ "@vnejs/module.components": "~0.2.0",
39
+ "@vnejs/contracts.controls": "~0.2.0",
40
+ "@vnejs/shared": "~0.2.0",
41
+ "@vnejs/uis.react": "~0.2.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vnejs/configs.ts-common": "~0.1.0"
44
+ "@vnejs/configs.ts-common": "~0.2.0",
45
+ "@vnejs/configs.vitest": "~0.2.0",
46
+ "@vnejs/test-utils": "~0.2.0",
47
+ "@vnejs/contracts.controls": "~0.2.0",
48
+ "@vnejs/contracts.views.screens.credits": "~0.2.0",
49
+ "@vnejs/helpers": "~0.2.0",
50
+ "@vnejs/module.core": "~0.2.0",
51
+ "@vnejs/module.components": "~0.2.0",
52
+ "@vnejs/shared": "~0.2.0",
53
+ "@vnejs/uis.react": "~0.2.0"
45
54
  }
46
55
  }
@@ -0,0 +1,31 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { spyEvent } from "@vnejs/test-utils";
4
+
5
+ import { Credits } from "../modules/credits.js";
6
+ import { createCreditsTestModule, registerCreditsPluginVne, SUBSCRIBE_EVENTS } from "./setup.js";
7
+
8
+ describe("Credits", () => {
9
+ beforeEach(() => {
10
+ registerCreditsPluginVne();
11
+ });
12
+
13
+ it("line exec show emits SHOW", async () => {
14
+ const { module, observer } = createCreditsTestModule(Credits, { subscribe: false });
15
+ const show = spyEvent(observer, SUBSCRIBE_EVENTS.SHOW);
16
+
17
+ await (module as Credits).init();
18
+ await (module as Credits).onLineExec({ line: "show" });
19
+
20
+ expect(show).toHaveBeenCalledOnce();
21
+ });
22
+
23
+ it("line exec hide emits HIDE", async () => {
24
+ const { module, observer } = createCreditsTestModule(Credits, { subscribe: false });
25
+ const hide = spyEvent(observer, SUBSCRIBE_EVENTS.HIDE);
26
+
27
+ await (module as Credits).onLineExec({ line: "hide" });
28
+
29
+ expect(hide).toHaveBeenCalledOnce();
30
+ });
31
+ });
@@ -0,0 +1,35 @@
1
+ import { CONSTANTS as CONTROLS_CONST, PLUGIN_NAME as CONTROLS, SUBSCRIBE_EVENTS as CONTROLS_EVENTS } from "@vnejs/contracts.controls";
2
+ import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.credits";
3
+ import {
4
+ createTestModule as baseCreateTestModule,
5
+ registerCoreVne,
6
+ registerVnePlugin,
7
+ stubSilentEvent,
8
+ } from "@vnejs/test-utils";
9
+
10
+ export const registerCreditsPluginVne = () => {
11
+ registerCoreVne();
12
+ registerVnePlugin(CONTROLS, { constants: CONTROLS_CONST, events: CONTROLS_EVENTS });
13
+ registerVnePlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS });
14
+ };
15
+
16
+ export const createCreditsTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
17
+ ModuleClass: T,
18
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
19
+ ) => {
20
+ const result = baseCreateTestModule(ModuleClass, {
21
+ state: {
22
+ credits: { isShow: false },
23
+ ...(options.state ?? {}),
24
+ },
25
+ ...options,
26
+ });
27
+
28
+ stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.SHOW);
29
+ stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.HIDE);
30
+ stubSilentEvent(result.observer, SUBSCRIBE_EVENTS.UPDATE);
31
+
32
+ return result;
33
+ };
34
+
35
+ export { SUBSCRIBE_EVENTS, PARAMS, PLUGIN_NAME };
package/tsconfig.json CHANGED
@@ -6,5 +6,5 @@
6
6
  "jsx": "react-jsx"
7
7
  },
8
8
  "include": ["src/**/*.ts", "src/**/*.tsx"],
9
- "exclude": ["dist", "node_modules"]
9
+ "exclude": ["dist", "node_modules", "src/tests"]
10
10
  }