@@ -24,6 +24,7 @@ func TestRecordInstall(t *testing.T) {
2424 tests := []struct {
2525 name string
2626 setup func (t * testing.T )
27+ host string
2728 skill string
2829 owner string
2930 repo string
@@ -35,6 +36,7 @@ func TestRecordInstall(t *testing.T) {
3536 }{
3637 {
3738 name : "fresh install creates lockfile" ,
39+ host : "github.com" ,
3840 skill : "code-review" ,
3941 owner : "monalisa" ,
4042 repo : "octocat-skills" ,
@@ -55,8 +57,25 @@ func TestRecordInstall(t *testing.T) {
5557 assert .Empty (t , e .PinnedRef )
5658 },
5759 },
60+ {
61+ name : "tenancy host uses correct URL" ,
62+ host : "mycompany.ghe.com" ,
63+ skill : "code-review" ,
64+ owner : "monalisa" ,
65+ repo : "octocat-skills" ,
66+ skillPath : "skills/code-review/SKILL.md" ,
67+ treeSHA : "abc123" ,
68+ verify : func (t * testing.T , lockPath string ) {
69+ t .Helper ()
70+ f := readTestLockfile (t , lockPath )
71+ require .Contains (t , f .Skills , "code-review" )
72+ e := f .Skills ["code-review" ]
73+ assert .Equal (t , "https://mycompany.ghe.com/monalisa/octocat-skills.git" , e .SourceURL )
74+ },
75+ },
5876 {
5977 name : "install with pinned ref" ,
78+ host : "github.com" ,
6079 skill : "pr-summary" ,
6180 owner : "hubot" ,
6281 repo : "skills-repo" ,
@@ -73,8 +92,9 @@ func TestRecordInstall(t *testing.T) {
7392 name : "multiple skills coexist" ,
7493 setup : func (t * testing.T ) {
7594 t .Helper ()
76- require .NoError (t , RecordInstall ("code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "sha1" , "" ))
95+ require .NoError (t , RecordInstall ("github.com" , " code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "sha1" , "" ))
7796 },
97+ host : "github.com" ,
7898 skill : "issue-triage" ,
7999 owner : "monalisa" ,
80100 repo : "octocat-skills" ,
@@ -107,6 +127,7 @@ func TestRecordInstall(t *testing.T) {
107127 require .NoError (t , err )
108128 t .Cleanup (unlock )
109129 },
130+ host : "github.com" ,
110131 skill : "code-review" ,
111132 owner : "monalisa" ,
112133 repo : "octocat-skills" ,
@@ -123,6 +144,7 @@ func TestRecordInstall(t *testing.T) {
123144 require .NoError (t , os .MkdirAll (filepath .Dir (lockPath ), 0o755 ))
124145 require .NoError (t , os .WriteFile (lockPath , []byte ("{invalid json" ), 0o644 ))
125146 },
147+ host : "github.com" ,
126148 skill : "code-review" ,
127149 owner : "monalisa" ,
128150 repo : "octocat-skills" ,
@@ -145,6 +167,7 @@ func TestRecordInstall(t *testing.T) {
145167 data , _ := json .Marshal (file {Version : 999 , Skills : map [string ]entry {"old-skill" : {}}})
146168 require .NoError (t , os .WriteFile (lockPath , data , 0o644 ))
147169 },
170+ host : "github.com" ,
148171 skill : "code-review" ,
149172 owner : "monalisa" ,
150173 repo : "octocat-skills" ,
@@ -166,7 +189,7 @@ func TestRecordInstall(t *testing.T) {
166189 tt .setup (t )
167190 }
168191
169- err := RecordInstall (tt .skill , tt .owner , tt .repo , tt .skillPath , tt .treeSHA , tt .pinnedRef )
192+ err := RecordInstall (tt .host , tt . skill , tt .owner , tt .repo , tt .skillPath , tt .treeSHA , tt .pinnedRef )
170193 if tt .wantErr {
171194 require .Error (t , err )
172195 return
@@ -181,10 +204,10 @@ func TestRecordInstall(t *testing.T) {
181204 t .Run ("update preserves InstalledAt and updates treeSHA" , func (t * testing.T ) {
182205 lockPath := setupTestHome (t )
183206
184- require .NoError (t , RecordInstall ("code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "old-sha" , "" ))
207+ require .NoError (t , RecordInstall ("github.com" , " code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "old-sha" , "" ))
185208 firstInstalledAt := readTestLockfile (t , lockPath ).Skills ["code-review" ].InstalledAt
186209
187- require .NoError (t , RecordInstall ("code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "new-sha" , "" ))
210+ require .NoError (t , RecordInstall ("github.com" , " code-review" , "monalisa" , "octocat-skills" , "skills/code-review/SKILL.md" , "new-sha" , "" ))
188211 entry := readTestLockfile (t , lockPath ).Skills ["code-review" ]
189212
190213 assert .Equal (t , "new-sha" , entry .SkillFolderHash , "treeSHA should be updated" )
0 commit comments