1+ import { describe , test , expect } from "vitest" ;
2+ import { GitClient } from "../src/git.js" ;
3+
4+ describe ( "GitClient backward compatibility" , ( ) => {
5+ test ( "default GitClient singleton still works" , ( ) => {
6+ const git = GitClient . default ( ) ;
7+ expect ( git ) . toBeDefined ( ) ;
8+ expect ( typeof git . cwd ) . toBe ( "string" ) ;
9+ expect ( git . workspace ) . toBeUndefined ( ) ; // Default should not have workspace
10+ } ) ;
11+
12+ test ( "GitClient constructor with only cwd still works" , ( ) => {
13+ const git = new GitClient ( "/some/path" ) ;
14+ expect ( git . cwd ) . toBe ( "/some/path" ) ;
15+ expect ( git . workspace ) . toBeUndefined ( ) ;
16+ } ) ;
17+
18+ test ( "GitClient.client() with only cwd still works" , ( ) => {
19+ const git = GitClient . default ( ) ;
20+ const newGit = git . client ( "/another/path" ) ;
21+ expect ( newGit . cwd ) . toBe ( "/another/path" ) ;
22+ expect ( newGit . workspace ) . toBeUndefined ( ) ;
23+ } ) ;
24+
25+ test ( "all existing GitClient methods are available" , ( ) => {
26+ const git = new GitClient ( "/test" ) ;
27+
28+ // Check key methods exist
29+ expect ( typeof git . defaultBranch ) . toBe ( "function" ) ;
30+ expect ( typeof git . branch ) . toBe ( "function" ) ;
31+ expect ( typeof git . exec ) . toBe ( "function" ) ;
32+ expect ( typeof git . fetch ) . toBe ( "function" ) ;
33+ expect ( typeof git . pull ) . toBe ( "function" ) ;
34+ expect ( typeof git . listBranches ) . toBe ( "function" ) ;
35+ expect ( typeof git . listFiles ) . toBe ( "function" ) ;
36+ expect ( typeof git . diff ) . toBe ( "function" ) ;
37+ expect ( typeof git . log ) . toBe ( "function" ) ;
38+ expect ( typeof git . client ) . toBe ( "function" ) ;
39+ expect ( typeof git . toString ) . toBe ( "function" ) ;
40+ } ) ;
41+ } ) ;
0 commit comments