You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
685 B
11 lines
685 B
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);
|
|
});
|
|
});
|