1+ import { describe , it , expect , vi , beforeEach } from 'vitest' ;
2+ import { DeeplinkHandler , DeeplinkHandlerError } from '../deeplink-handler' ;
3+
4+ describe ( 'DeeplinkHandler' , ( ) => {
5+ describe ( 'initialization' , ( ) => {
6+ it ( 'should throw if context is not provided' , ( ) => {
7+ expect ( ( ) => new DeeplinkHandler ( null as any ) ) . toThrow ( ) ;
8+ } ) ;
9+
10+ it ( 'should accept empty context object' , ( ) => {
11+ const handler = new DeeplinkHandler ( { } ) ;
12+ expect ( handler ) . toBeDefined ( ) ;
13+ } ) ;
14+ } ) ;
15+
16+ describe ( 'handle valid actions' , ( ) => {
17+ it ( 'should handle record action' , async ( ) => {
18+ const onStartRecording = vi . fn ( ) ;
19+ const handler = new DeeplinkHandler ( { onStartRecording } ) ;
20+
21+ const result = await handler . handle ( 'cap://record' ) ;
22+
23+ expect ( result ) . toBe ( true ) ;
24+ expect ( onStartRecording ) . toHaveBeenCalledOnce ( ) ;
25+ } ) ;
26+
27+ it ( 'should handle stop action' , async ( ) => {
28+ const onStopRecording = vi . fn ( ) ;
29+ const handler = new DeeplinkHandler ( { onStopRecording } ) ;
30+
31+ const result = await handler . handle ( 'cap://stop' ) ;
32+
33+ expect ( result ) . toBe ( true ) ;
34+ expect ( onStopRecording ) . toHaveBeenCalledOnce ( ) ;
35+ } ) ;
36+
37+ it ( 'should handle pause action' , async ( ) => {
38+ const onPauseRecording = vi . fn ( ) ;
39+ const handler = new DeeplinkHandler ( { onPauseRecording } ) ;
40+
41+ const result = await handler . handle ( 'cap://
0 commit comments