-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.ts
31 lines (23 loc) · 1.06 KB
/
main_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import 'jsr:@std/dotenv/load';
import { assertEquals } from 'jsr:@std/assert@1.0.8';
import { parseArgs } from '@std/cli';
import { options } from './main.ts';
const TEST_KEY_CODE = Deno.env.get('TEST_KEY_CODE') || '';
Deno.test('check-link command - parses URL argument', () => {
const args = ['check-link', 'https://example.com'];
const parsedArgs = parseArgs(args, options);
assertEquals(parsedArgs._, ['check-link', 'https://example.com']);
assertEquals(parsedArgs._.length, 2);
});
Deno.test('check-link command - parses URL and key code arguments', () => {
const args = ['check-link', 'https://example.com', '--key-code', TEST_KEY_CODE];
const parsedArgs = parseArgs(args, options);
assertEquals(parsedArgs._, ['check-link', 'https://example.com', '']);
assertEquals(parsedArgs['key-code'], TEST_KEY_CODE);
});
Deno.test('check-link command - handles missing URL argument', () => {
const args = ['check-link'];
const parsedArgs = parseArgs(args, options);
assertEquals(parsedArgs._.length, 1);
assertEquals(parsedArgs._[0], 'check-link');
});