Skip to content

Commit

Permalink
Introduce a memory leak to check k6 tests (#5213)
Browse files Browse the repository at this point in the history
Revert "Fix frontend memory leak (#4864)"
This reverts commit a5d966d
  • Loading branch information
obulat authored Nov 29, 2024
1 parent 699455d commit 95fd407
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
28 changes: 15 additions & 13 deletions frontend/src/stores/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,22 @@ export interface UiState {

export const breakpoints = Object.keys(ALL_SCREEN_SIZES)

export const defaultUiState: UiState = {
instructionsSnackbarState: "not_shown",
innerFilterVisible: false,
isFilterDismissed: false,
isDesktopLayout: false,
breakpoint: "sm",
dismissedBanners: [],
shouldBlurSensitive: true,
revealedSensitiveResults: [],
headerHeight: 80,
colorMode: "system",
isDarkModeSeen: false,
}

export const useUiStore = defineStore("ui", {
state: (): UiState => ({
instructionsSnackbarState: "not_shown",
innerFilterVisible: false,
isFilterDismissed: false,
isDesktopLayout: false,
breakpoint: "sm",
dismissedBanners: [],
shouldBlurSensitive: true,
revealedSensitiveResults: [],
headerHeight: 80,
colorMode: "system",
isDarkModeSeen: false,
}),
state: (): UiState => ({ ...defaultUiState }),

getters: {
cookieState(state): OpenverseCookieState["ui"] {
Expand Down
17 changes: 2 additions & 15 deletions frontend/test/unit/specs/stores/ui-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { vi, describe, beforeEach, it, expect, test } from "vitest"

import { setActivePinia, createPinia } from "~~/test/unit/test-utils/pinia"

import { UiState, useUiStore } from "~/stores/ui"
import { defaultUiState, UiState, useUiStore } from "~/stores/ui"
import { BannerId } from "~/types/banners"

vi.mock("~/types/cookies", async () => {
Expand All @@ -19,20 +19,7 @@ vi.mock("~/types/cookies", async () => {
}
})

// Should mirror the "state" property of useUiStore
const initialState: UiState = {
instructionsSnackbarState: "not_shown",
innerFilterVisible: false,
isFilterDismissed: false,
isDesktopLayout: false,
breakpoint: "sm",
dismissedBanners: [],
shouldBlurSensitive: true,
revealedSensitiveResults: [],
headerHeight: 80,
colorMode: "system",
isDarkModeSeen: false,
}
const initialState = defaultUiState

const VISIBLE_AND_DISMISSED = {
innerFilterVisible: true,
Expand Down

0 comments on commit 95fd407

Please sign in to comment.