sm-click-library-ui 0.0.458 → 0.0.463

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.
@@ -1,66 +1,66 @@
1
- import { JSDOM } from "jsdom";
2
- import { config } from "@vue/test-utils";
3
- import { setActivePinia, createPinia } from "pinia";
4
-
5
- // Cria um DOM simulado
6
- const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
- url: "http://localhost",
8
- });
9
-
10
- // Configura `window` e `document`
11
- global.window = dom.window;
12
- global.document = dom.window.document;
13
- global.navigator = dom.window.navigator;
14
-
15
- // Mock de métodos do DOM que podem ser necessários
16
- global.window.HTMLElement = dom.window.HTMLElement;
17
- global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
- global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
-
20
- global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
- observe: vi.fn(),
22
- unobserve: vi.fn(),
23
- disconnect: vi.fn(),
24
- }));
25
-
26
- global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
- matches: false,
28
- addListener: vi.fn(),
29
- removeListener: vi.fn(),
30
- }));
31
-
32
- // Configuração global do Vue Test Utils
33
- config.global.stubs = {
34
- Popper: true, // Evita erro de componente não encontrado
35
- VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
- SimpleModal: true, // Stub para SimpleModal
37
- datepicker: true, // Stub para datepicker,
38
- Svg: { template: "<svg></svg>" },
39
- Popper: { template: "<div><slot /></div>" },
40
- putVideo: { template: "<div></div>" },
41
- VueAwesomePaginate: { template: "<div></div>" },
42
- SimpleLoader: { template: "<div></div>" },
43
- };
44
-
45
- config.global.directives = {
46
- lazy: () => {},
47
- };
48
-
49
- // Ativando Pinia para os testes
50
- setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
51
-
52
- // Mock de axios para evitar chamadas reais de API
53
- import { vi } from "vitest";
54
-
55
- vi.mock("@/router/axios", () => ({
56
- default: {
57
- get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
58
- post: vi.fn(),
59
- delete: vi.fn(),
60
- patch: vi.fn(),
61
- },
62
- }));
63
- // Mock de notiwind para evitar notificações em testes
64
- vi.mock("notiwind", () => ({
65
- notify: vi.fn(),
66
- }));
1
+ import { JSDOM } from "jsdom";
2
+ import { config } from "@vue/test-utils";
3
+ import { setActivePinia, createPinia } from "pinia";
4
+
5
+ // Cria um DOM simulado
6
+ const dom = new JSDOM(`<!DOCTYPE html><html><body></body></html>`, {
7
+ url: "http://localhost",
8
+ });
9
+
10
+ // Configura `window` e `document`
11
+ global.window = dom.window;
12
+ global.document = dom.window.document;
13
+ global.navigator = dom.window.navigator;
14
+
15
+ // Mock de métodos do DOM que podem ser necessários
16
+ global.window.HTMLElement = dom.window.HTMLElement;
17
+ global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
18
+ global.window.cancelAnimationFrame = (id) => clearTimeout(id);
19
+
20
+ global.ResizeObserver = vi.fn().mockImplementation(() => ({
21
+ observe: vi.fn(),
22
+ unobserve: vi.fn(),
23
+ disconnect: vi.fn(),
24
+ }));
25
+
26
+ global.window.matchMedia = vi.fn().mockImplementation(() => ({
27
+ matches: false,
28
+ addListener: vi.fn(),
29
+ removeListener: vi.fn(),
30
+ }));
31
+
32
+ // Configuração global do Vue Test Utils
33
+ config.global.stubs = {
34
+ Popper: true, // Evita erro de componente não encontrado
35
+ VueAwesomePaginate: true, // Stub para VueAwesomePaginate
36
+ SimpleModal: true, // Stub para SimpleModal
37
+ datepicker: true, // Stub para datepicker,
38
+ Svg: { template: "<svg></svg>" },
39
+ Popper: { template: "<div><slot /></div>" },
40
+ putVideo: { template: "<div></div>" },
41
+ VueAwesomePaginate: { template: "<div></div>" },
42
+ SimpleLoader: { template: "<div></div>" },
43
+ };
44
+
45
+ config.global.directives = {
46
+ lazy: () => {},
47
+ };
48
+
49
+ // Ativando Pinia para os testes
50
+ setActivePinia(createPinia()); // Certifica que Pinia está disponível nos testes
51
+
52
+ // Mock de axios para evitar chamadas reais de API
53
+ import { vi } from "vitest";
54
+
55
+ vi.mock("@/router/axios", () => ({
56
+ default: {
57
+ get: vi.fn().mockResolvedValue({ data: [] }), // Return an empty array (or any default data)
58
+ post: vi.fn(),
59
+ delete: vi.fn(),
60
+ patch: vi.fn(),
61
+ },
62
+ }));
63
+ // Mock de notiwind para evitar notificações em testes
64
+ vi.mock("notiwind", () => ({
65
+ notify: vi.fn(),
66
+ }));