import { describe, it, expect } from 'vitest' import { validate } from '../src' import { mockCtx } from '@lambdahk/core' describe('my-hook', () => { it('allows when disabled', async () => { const ctx = mockCtx() const result = await validate(ctx, { enabled: false }) expect(result.granted).toBe(true) }) it('blocks suspicious IP', async () => { const ctx = mockCtx({ host: '102.88.67.12' }) const result = await validate(ctx, { enabled: true }) expect(result.granted).toBe(false) expect(result.reason).toBe('Suspicious IP address') }) it('allows clean IP', async () => { const ctx = mockCtx({ host: '41.203.77.11' }) const result = await validate(ctx, { enabled: true }) expect(result.granted).toBe(true) }) })