repo mirror list: fix missed sort keys in unit tests · Entire

repo mirror list: fix missed sort keys in unit tests

12c2e30→main·

gtrrz-victor·1w ago·1 file·+6 added/-6 removed

TestSortMirrors/TestSortAvailable still passed the old "repo" sort key (-repo, " -repo") and asserted the error names "repo" — missed by the REPO->NAME rename since it only touched the runMirrorList cases. Update to the "name" key so the whole package (and test:ci) stays green.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KX0NP0PCPE07HAD72JYAYCYBView transcript

[?
Rename Repo Column to Name for ConsistencyClaude Code·2 steps](/content/gh/entireio/cli/session/dec0d061-ea6a-4326-b5dd-6ba25b48eed6#timeline-01KX0NP0PCPE07HAD72JYAYCYB/index.html)

Changes

1

1143 unmodified lines

1144
1145
1146
1147
1147
1148
1149
1150
1150
1151
1152
1153
1 unmodified line

1155
1156
1157
1158
1158
1159
1160
1161
12 unmodified lines

1174
1175
1176
1177
1177
1178
1179
1180
6 unmodified lines

1187
1188
1189
1190
1190
1191
1192
1193
26 unmodified lines

1220
1221
1222
1223
1223
1224
1225
1226

1143 unmodified lines

}, mirrorRepoHosts(m))
    })

t.Run("-repo reverses the whole ordering, tiebreak included", func(t *testing.T) {
t.Run("-name reverses the whole ordering, tiebreak included", func(t *testing.T) {
            
t.Parallel()
            m := base()
            require.NoError(t, sortMirrors(m, "-repo"))
            require.NoError(t, sortMirrors(m, "-name"))
            require.Equal(t, []string{
                "acme/web@eu-west-1.entire.io",
                "acme/web@aws-us-east-2.entire.io",
1 unmodified line

})
            }, mirrorRepoHosts(m))
    })

t.Run("non-repo column sorts keep the owner/repo+cluster tiebreak", func(t *testing.T) {
t.Run("non-name column sorts keep the owner/repo+cluster tiebreak", func(t *testing.T) {
            
t.Parallel()
            // All three sort keys collide on "private" once acme/api and the aws web
            // mirror are both public; the deterministic order must fall back to
12 unmodified lines

t.Run("whitespace spec parses direction from the trimmed spec", func(t *testing.T) {
            
t.Parallel()
            m := base()
            require.NoError(t, sortMirrors(m, " -repo"))
            require.NoError(t, sortMirrors(m, " -name"))
            require.Equal(t, []string{
                "acme/web@eu-west-1.entire.io",
                "acme/web@aws-us-east-2.entire.io",
6 unmodified lines

})
        } )

err := sortMirrors(base(), "nope")
    require.Error(t, err)
    require.Contains(t, err.Error(), "unknown sort column")
    require.Contains(t, err.Error(), "repo")
    require.Contains(t, err.Error(), "name")
})
}

26 unmodified lines

t.Run("whitespace spec parses direction from the trimmed spec", func(t *testing.T) {
            
t.Parallel()
            a := base()
            require.NoError(t, sortAvailable(a, " -repo"))
            require.NoError(t, sortAvailable(a, " -name"))
            require.Equal(t, []string{"acme/web", "acme/cli", "acme/api"}, repos(a))
            })

Mcmd/entire/cli/repo_mirror_test.go+6/-6