Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit d6e1c4b

Browse files
committed
add unit test
1 parent 6e1ed36 commit d6e1c4b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/db/dbutil/dbutil_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,15 @@ func TestPostgresDSN(t *testing.T) {
6767
})
6868
}
6969
}
70+
71+
func TestInjectVersionUpdate(t *testing.T) {
72+
gotContents, err := injectVersionUpdate(func(name string) ([]byte, error) { return []byte("BEGIN;\n-- some statements...\nCOMMIT;"), nil })("migrations/100_dummy.up.sql")
73+
if err != nil {
74+
t.Fatal(err)
75+
}
76+
got := string(gotContents)
77+
want := "BEGIN;\n-- some statements...\nUPDATE schema_migrations SET dirty=false;\nCOMMIT;"
78+
if got != want {
79+
t.Errorf("incorrect contents: got != want\ngot: %v\nwant: %v", got, want)
80+
}
81+
}

0 commit comments

Comments
 (0)