Skip to content

Commit bda6a78

Browse files
committed
Use constant to set repositories source and add tests
Signed-off-by: Javi Fontan <[email protected]>
1 parent c822e39 commit bda6a78

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

repositories.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (repositoriesTable) Name() string {
2424

2525
func (repositoriesTable) Schema() sql.Schema {
2626
return sql.Schema{
27-
{Name: "id", Type: sql.Text, Nullable: false, Source: "repositories"},
27+
{Name: "id", Type: sql.Text, Nullable: false, Source: repositoriesTableName},
2828
}
2929
}
3030

repositories_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ func TestRepositoriesTable_Name(t *testing.T) {
1515
f := fixtures.Basic().One()
1616
table := getTable(require, f, repositoriesTableName)
1717
require.Equal(repositoriesTableName, table.Name())
18+
19+
// Check that each column source is the same as table name
20+
for _, c := range table.Schema() {
21+
require.Equal(repositoriesTableName, c.Source)
22+
}
1823
}
1924

2025
func TestRepositoriesTable_Children(t *testing.T) {

0 commit comments

Comments
 (0)