Skip to content

Commit bca9115

Browse files
luizhf42gustavosbarreto
authored andcommitted
fix(ui): remove unnecessary flushPromises calls and use vue's nextTick
1 parent 959b785 commit bca9115

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ui/tests/components/Sessions/Player.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { mount, flushPromises, VueWrapper } from "@vue/test-utils";
1+
import { mount, VueWrapper } from "@vue/test-utils";
22
import { describe, beforeEach, vi, it, expect, afterEach } from "vitest";
3+
import { nextTick } from "vue";
34
import { createVuetify } from "vuetify";
45
import { SnackbarPlugin } from "@/plugins/snackbar";
56
import { router } from "@/router";
@@ -40,7 +41,6 @@ describe("Asciinema Player", () => {
4041

4142
afterEach(() => {
4243
wrapper.unmount();
43-
vi.clearAllMocks();
4444
});
4545

4646
it("Is a Vue instance", () => {
@@ -52,7 +52,6 @@ describe("Asciinema Player", () => {
5252
});
5353

5454
it("Renders components", async () => {
55-
await flushPromises();
5655
expect(wrapper.find('[data-test="player-container"]').exists()).toBe(true);
5756
expect(wrapper.find('[data-test="player-controls"]').exists()).toBe(true);
5857
expect(wrapper.find('[data-test="pause-btn"]').exists()).toBe(true);
@@ -64,7 +63,6 @@ describe("Asciinema Player", () => {
6463
});
6564

6665
it("Creates player on mount", async () => {
67-
await flushPromises();
6866
expect(wrapper.vm.player).toBeDefined();
6967
});
7068

@@ -76,7 +74,7 @@ describe("Asciinema Player", () => {
7674

7775
it("Shows pause button when player is playing", async () => {
7876
wrapper.vm.isPlaying = true;
79-
await wrapper.vm.$nextTick();
77+
await nextTick();
8078

8179
const pauseBtn = wrapper.find('[data-test="pause-btn"]');
8280

@@ -86,11 +84,11 @@ describe("Asciinema Player", () => {
8684

8785
it("Shows play button when player is paused", async () => {
8886
wrapper.vm.isPlaying = true;
89-
await wrapper.vm.$nextTick();
87+
await nextTick();
9088
const pauseBtn = wrapper.find('[data-test="pause-btn"]');
9189

9290
await pauseBtn.trigger("click");
93-
await wrapper.vm.$nextTick();
91+
await nextTick();
9492

9593
expect(wrapper.find('[data-test="pause-btn"]').exists()).toBe(false);
9694
expect(wrapper.find('[data-test="play-btn"]').exists()).toBe(true);

0 commit comments

Comments
 (0)