migrate pure-logic tests to vitest (phase 1)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import {jest} from '@jest/globals'
|
||||
import {vi} from 'vitest'
|
||||
|
||||
import {transparentifyColor} from '../colorGeneration'
|
||||
|
||||
describe('transparentifyColor', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('converts hsl() to hsla()', () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {describe, test} from '@jest/globals'
|
||||
import {vi} from 'vitest'
|
||||
|
||||
import {
|
||||
computeCompletedState,
|
||||
syncCompletedState,
|
||||
} from '#/components/PolicyUpdateOverlay/usePolicyUpdateState'
|
||||
|
||||
jest.mock('../../../state/queries/nuxs')
|
||||
vi.mock('../../../state/queries/nuxs')
|
||||
|
||||
describe('computeCompletedState', () => {
|
||||
test(`initial state`, () => {
|
||||
@@ -67,8 +67,8 @@ describe('computeCompletedState', () => {
|
||||
describe('syncCompletedState', () => {
|
||||
describe('!nuxIsReady', () => {
|
||||
test(`!completedForDevice, no-op`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: false,
|
||||
nuxIsCompleted: false,
|
||||
@@ -83,8 +83,8 @@ describe('syncCompletedState', () => {
|
||||
})
|
||||
|
||||
test(`completedForDevice, no-op`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: false,
|
||||
nuxIsCompleted: false,
|
||||
@@ -103,8 +103,8 @@ describe('syncCompletedState', () => {
|
||||
describe(`!nuxIsCompleted`, () => {
|
||||
describe(`!nuxIsOptimisticallyCompleted`, () => {
|
||||
test(`!completedForDevice, no-op`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: true,
|
||||
nuxIsCompleted: false,
|
||||
@@ -119,8 +119,8 @@ describe('syncCompletedState', () => {
|
||||
})
|
||||
|
||||
test(`completedForDevice, syncs to server`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: true,
|
||||
nuxIsCompleted: false,
|
||||
@@ -141,8 +141,8 @@ describe('syncCompletedState', () => {
|
||||
*/
|
||||
describe(`nuxIsOptimisticallyCompleted`, () => {
|
||||
test(`completedForDevice, no-op`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: true,
|
||||
nuxIsCompleted: false,
|
||||
@@ -160,8 +160,8 @@ describe('syncCompletedState', () => {
|
||||
|
||||
describe(`nuxIsCompleted`, () => {
|
||||
test(`!completedForDevice, syncs to device`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: true,
|
||||
nuxIsCompleted: true,
|
||||
@@ -176,8 +176,8 @@ describe('syncCompletedState', () => {
|
||||
})
|
||||
|
||||
test(`completedForDevice, no-op`, () => {
|
||||
const save = jest.fn()
|
||||
const setCompletedForDevice = jest.fn()
|
||||
const save = vi.fn()
|
||||
const setCompletedForDevice = vi.fn()
|
||||
syncCompletedState({
|
||||
nuxIsReady: true,
|
||||
nuxIsCompleted: true,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {getInviteTheme, INVITE_THEME_KEYS, INVITE_THEMES} from './themes'
|
||||
|
||||
describe('invite themes', () => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {getInviteDisplayUrl, getInviteShareUrl} from './urls'
|
||||
|
||||
describe('invite URLs', () => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {parseLinkingUrl} from '../parseLinkingUrl'
|
||||
|
||||
describe('parseLinkingUrl', () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
import {addDays, subDays, subHours, subMinutes, subSeconds} from 'date-fns'
|
||||
|
||||
import {dateDiff} from '../useTimeAgo'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {expect, test} from '@jest/globals'
|
||||
|
||||
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
|
||||
import {AppLanguage} from '#/locale/languages'
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {expect, test} from '@jest/globals'
|
||||
|
||||
import {add, type ConsoleTransportEntry, getEntries} from '#/logger/logDump'
|
||||
import {LogContext, LogLevel} from '#/logger/types'
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {
|
||||
countActiveFilters,
|
||||
definedFilterParams,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {parseSearchQuery} from '#/screens/Search/utils'
|
||||
|
||||
describe(`parseSearchQuery`, () => {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {
|
||||
makeFilter,
|
||||
parseAdvancedSearch,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, it} from '@jest/globals'
|
||||
|
||||
describe(`#/state/messages/convo`, () => {
|
||||
describe(`init`, () => {
|
||||
it.todo(`fails if sender and recipients aren't found`)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import {describe, expect, it} from '@jest/globals'
|
||||
|
||||
import {
|
||||
buildSearchPostsV2Filters,
|
||||
extractSearchPostsParams,
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import {jest} from '@jest/globals'
|
||||
import {vi} from 'vitest'
|
||||
|
||||
export {Nux} from '#/state/queries/nuxs/definitions'
|
||||
|
||||
export const useNuxs = jest.fn(() => {
|
||||
export const useNuxs = vi.fn(() => {
|
||||
return {
|
||||
nuxs: undefined,
|
||||
status: 'loading' as const,
|
||||
}
|
||||
})
|
||||
|
||||
export const useNux = jest.fn((id: string) => {
|
||||
export const useNux = vi.fn((id: string) => {
|
||||
return {
|
||||
nux: undefined,
|
||||
status: 'loading' as const,
|
||||
}
|
||||
})
|
||||
|
||||
export const useSaveNux = jest.fn(() => {
|
||||
export const useSaveNux = vi.fn(() => {
|
||||
return {}
|
||||
})
|
||||
|
||||
export const useResetNuxs = jest.fn(() => {
|
||||
export const useResetNuxs = vi.fn(() => {
|
||||
return {}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user