Skip to content

Introduce a memory leak to check k6 tests #5213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading