- Introduced tests for mail templates including ranking, rendering, and attachment handling. - Added tests for time billing selection and approval processes, ensuring proper validation and state management. - Implemented tests for case types in JavaScript, focusing on loading and editing functionality. - Created tests for contact mail AI integration, ensuring proper parsing and error handling. - Developed tests for dark theme CSS contrast and loading order. - Added tests for invoice fee service, covering various scenarios including exemptions and invalid inputs. - Implemented vendor resource tests, ensuring proper file handling and query validation.
15 lines
1.2 KiB
JavaScript
15 lines
1.2 KiB
JavaScript
const assert=require('node:assert/strict');global.window={};require('../../static/js/link-targets.js');const {href,sshTarget}=window.LinkTargets;
|
|
assert.equal(href({type:'ssh',host:'server.local',username:'admin',port:2222}),'ssh://admin@server.local:2222');
|
|
assert.equal(href({type:'ssh',url:'ssh://admin@server.local:2222'}),'ssh://admin@server.local:2222');
|
|
assert.equal(sshTarget({host:'server.local:2222',username:'admin'}).command,'ssh -p 2222 admin@server.local');
|
|
assert.equal(href({type:'ssh',host:'2001:db8::1'}),'ssh://[2001:db8::1]');
|
|
assert.equal(href({type:'ssh',url:'ssh://admin@[2001:db8::1]:2222'}),'ssh://admin@[2001:db8::1]:2222');
|
|
for(const host of ['-oProxyCommand=bad','server;bad','server$(bad)','server/path','server bad'])assert.equal(sshTarget({host}),null);
|
|
assert.equal(href({type:'ssh',url:'ssh://user:password@host'}),'');
|
|
assert.equal(href({type:'ssh',host:'server',port:99999}),'');
|
|
assert.equal(href({type:'http',host:'server.local'}),'http://server.local');
|
|
assert.equal(href({type:'http',url:'https://server.local/path'}),'https://server.local/path');
|
|
assert.equal(href({type:'http',url:'javascript:alert(1)'}),'');
|
|
assert.equal(href({type:'command',url:'ssh host'}),'');
|
|
console.log('SSH/web target regression checks passed');
|