-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(releases): timezone selection updates filtering and dateTime dis…
…play on release overview (#7854)
- Loading branch information
Showing
4 changed files
with
178 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/sanity/src/core/scheduledPublishing/hooks/__tests__/__mocks__/useTimeZone.mock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {type Mock, type Mocked, vi} from 'vitest' | ||
|
||
import {type NormalizedTimeZone} from '../../../types' | ||
import useTimeZone, {getLocalTimeZone} from '../../useTimeZone' | ||
|
||
const mockTimeZone: NormalizedTimeZone = { | ||
abbreviation: 'SCT', // Sanity Central Time :) | ||
namePretty: 'Sanity/Oslo', | ||
offset: '+00:00', | ||
name: 'SCT', | ||
alternativeName: 'Sanity/Oslo', | ||
mainCities: 'Oslo', | ||
value: 'SCT', | ||
} | ||
|
||
// default export | ||
export const useTimeZoneMockReturn: Mocked<ReturnType<typeof useTimeZone>> = { | ||
zoneDateToUtc: vi.fn((date) => date), | ||
utcToCurrentZoneDate: vi.fn((date) => date), | ||
getCurrentZoneDate: vi.fn(() => new Date()), | ||
timeZone: mockTimeZone, | ||
setTimeZone: vi.fn(), | ||
formatDateTz: vi.fn(), | ||
} | ||
|
||
export const getLocalTimeZoneMockReturn: Mocked<ReturnType<typeof getLocalTimeZone>> = mockTimeZone | ||
|
||
// default export | ||
export const mockUseTimeZone = useTimeZone as Mock<typeof useTimeZone> | ||
|
||
export const mockGetLocaleTimeZone = getLocalTimeZone as Mock<typeof getLocalTimeZone> |