(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestRecordInstall(t *testing.T) { |
| 24 | tests := []struct { |
| 25 | name string |
| 26 | setup func(t *testing.T) |
| 27 | host string |
| 28 | skill string |
| 29 | owner string |
| 30 | repo string |
| 31 | skillPath string |
| 32 | treeSHA string |
| 33 | pinnedRef string |
| 34 | wantErr bool |
| 35 | verify func(t *testing.T, lockPath string) |
| 36 | }{ |
| 37 | { |
| 38 | name: "fresh install creates lockfile", |
| 39 | host: "github.com", |
| 40 | skill: "code-review", |
| 41 | owner: "monalisa", |
| 42 | repo: "octocat-skills", |
| 43 | skillPath: "skills/code-review/SKILL.md", |
| 44 | treeSHA: "abc123", |
| 45 | verify: func(t *testing.T, lockPath string) { |
| 46 | t.Helper() |
| 47 | f := readTestLockfile(t, lockPath) |
| 48 | require.Contains(t, f.Skills, "code-review") |
| 49 | e := f.Skills["code-review"] |
| 50 | assert.Equal(t, "monalisa/octocat-skills", e.Source) |
| 51 | assert.Equal(t, "github", e.SourceType) |
| 52 | assert.Equal(t, "https://github.com/monalisa/octocat-skills.git", e.SourceURL) |
| 53 | assert.Equal(t, "skills/code-review/SKILL.md", e.SkillPath) |
| 54 | assert.Equal(t, "abc123", e.SkillFolderHash) |
| 55 | assert.NotEmpty(t, e.InstalledAt) |
| 56 | assert.NotEmpty(t, e.UpdatedAt) |
| 57 | assert.Empty(t, e.PinnedRef) |
| 58 | }, |
| 59 | }, |
| 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 | }, |
| 76 | { |
| 77 | name: "install with pinned ref", |
| 78 | host: "github.com", |
| 79 | skill: "pr-summary", |
| 80 | owner: "hubot", |
nothing calls this directly
no test coverage detected