import { describe, expect, it } from 'vitest'; import { secureTransferOrigin } from './secure-transfer-origin'; describe('Secure transfer origin',()=>{ it('accepts HTTPS and loopback development, and rejects remote plaintext pages',()=>{ expect(secureTransferOrigin({protocol:'https:',hostname:'practice.example'})).toBe(true); expect(secureTransferOrigin({protocol:'http:',hostname:'localhost'})).toBe(true); expect(secureTransferOrigin({protocol:'http:',hostname:'practice.example'})).toBe(false); expect(secureTransferOrigin({protocol:'http:',hostname:'localhost.example'})).toBe(false); expect(secureTransferOrigin({protocol:'file:',hostname:''})).toBe(false); }); });