chore: clean cache

This commit is contained in:
GitHub Actions
2025-12-11 18:17:21 +00:00
parent b4dd1efe3c
commit 65d837a13f
646 changed files with 0 additions and 129862 deletions

View File

@@ -1,66 +0,0 @@
import { describe, it, expect } from 'vitest'
import compareHosts from '../compareHosts'
import type { ProxyHost } from '../../api/proxyHosts'
const hostA: ProxyHost = {
uuid: 'a',
name: 'Alpha',
domain_names: 'alpha.com',
forward_host: '127.0.0.1',
forward_port: 80,
forward_scheme: 'http',
enabled: true,
ssl_forced: false,
websocket_support: false,
certificate: null,
http2_support: false,
hsts_enabled: false,
hsts_subdomains: false,
block_exploits: false,
application: 'none',
locations: [],
created_at: '2025-01-01',
updated_at: '2025-01-01',
}
const hostB: ProxyHost = {
uuid: 'b',
name: 'Beta',
domain_names: 'beta.com',
forward_host: '127.0.0.2',
forward_port: 8080,
forward_scheme: 'http',
enabled: true,
ssl_forced: false,
websocket_support: false,
certificate: null,
http2_support: false,
hsts_enabled: false,
hsts_subdomains: false,
block_exploits: false,
application: 'none',
locations: [],
created_at: '2025-01-01',
updated_at: '2025-01-01',
}
describe('compareHosts', () => {
it('returns 0 for unknown sort column (default case)', () => {
const compareAny = compareHosts as unknown as (a: ProxyHost, b: ProxyHost, sortColumn: string, sortDirection: 'asc' | 'desc') => number
const res = compareAny(hostA, hostB, 'unknown', 'asc')
expect(res).toBe(0)
})
it('sorts by name', () => {
expect(compareHosts(hostA, hostB, 'name', 'asc')).toBeLessThan(0)
expect(compareHosts(hostB, hostA, 'name', 'asc')).toBeGreaterThan(0)
})
it('sorts by domain', () => {
expect(compareHosts(hostA, hostB, 'domain', 'asc')).toBeLessThan(0)
})
it('sorts by forward', () => {
expect(compareHosts(hostA, hostB, 'forward', 'asc')).toBeLessThan(0)
})
})

View File

@@ -1,40 +0,0 @@
import { describe, it, expect } from 'vitest'
import { calculatePasswordStrength } from '../passwordStrength'
describe('calculatePasswordStrength', () => {
it('returns score 0 for empty password', () => {
const result = calculatePasswordStrength('')
expect(result.score).toBe(0)
expect(result.label).toBe('Empty')
})
it('returns low score for short password', () => {
const result = calculatePasswordStrength('short')
expect(result.score).toBeLessThan(2)
})
it('returns higher score for longer password', () => {
const result = calculatePasswordStrength('longerpassword')
expect(result.score).toBeGreaterThanOrEqual(2)
})
it('rewards complexity (numbers, symbols, uppercase)', () => {
const simple = calculatePasswordStrength('password123')
const complex = calculatePasswordStrength('Password123!')
expect(complex.score).toBeGreaterThan(simple.score)
})
it('returns max score for strong password', () => {
const result = calculatePasswordStrength('CorrectHorseBatteryStaple1!')
expect(result.score).toBe(4)
expect(result.label).toBe('Strong')
})
it('provides feedback for weak passwords', () => {
const result = calculatePasswordStrength('123456')
expect(result.feedback).toBeDefined()
// The feedback is an array of strings
expect(result.feedback.length).toBeGreaterThan(0)
})
})

View File

@@ -1,40 +0,0 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { toast, toastCallbacks } from '../toast'
describe('toast util', () => {
beforeEach(() => {
// Ensure callbacks set is empty before each test
toastCallbacks.clear()
})
afterEach(() => {
toastCallbacks.clear()
})
it('calls registered callbacks for each toast type', () => {
const mock = vi.fn()
toastCallbacks.add(mock)
toast.success('ok')
toast.error('bad')
toast.info('info')
toast.warning('warn')
expect(mock).toHaveBeenCalledTimes(4)
expect(mock.mock.calls[0][0]).toMatchObject({ message: 'ok', type: 'success' })
expect(mock.mock.calls[1][0]).toMatchObject({ message: 'bad', type: 'error' })
expect(mock.mock.calls[2][0]).toMatchObject({ message: 'info', type: 'info' })
expect(mock.mock.calls[3][0]).toMatchObject({ message: 'warn', type: 'warning' })
})
it('provides incrementing ids', () => {
const mock = vi.fn()
toastCallbacks.add(mock)
// send multiple messages
toast.success('one')
toast.success('two')
const firstId = mock.mock.calls[0][0].id
const secondId = mock.mock.calls[1][0].id
expect(secondId).toBeGreaterThan(firstId)
})
})