diff options
Diffstat (limited to 'internal/postgres/insert_module_test.go')
| -rw-r--r-- | internal/postgres/insert_module_test.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go index 893f368c..44997549 100644 --- a/internal/postgres/insert_module_test.go +++ b/internal/postgres/insert_module_test.go @@ -101,11 +101,10 @@ func checkModule(ctx context.Context, t *testing.T, db *DB, want *internal.Modul if err != nil { t.Fatal(err) } - wantu.LicenseContents = sample.Licenses var subdirectories []*internal.PackageMeta for _, u := range want.Units { if u.IsPackage() && (strings.HasPrefix(u.Path, wantu.Path) || wantu.Path == stdlib.ModulePath) { - subdirectories = append(subdirectories, sample.PackageMeta(u.Path)) + subdirectories = append(subdirectories, packageMetaFromUnit(u)) } } wantu.Subdirectories = subdirectories @@ -119,6 +118,16 @@ func checkModule(ctx context.Context, t *testing.T, db *DB, want *internal.Modul } } +func packageMetaFromUnit(u *internal.Unit) *internal.PackageMeta { + return &internal.PackageMeta{ + Path: u.Path, + IsRedistributable: u.IsRedistributable, + Name: u.Name, + Synopsis: u.Documentation[0].Synopsis, + Licenses: u.Licenses, + } +} + func TestInsertModuleLicenseCheck(t *testing.T) { t.Parallel() ctx := context.Background() @@ -188,7 +197,9 @@ func TestUpsertModule(t *testing.T) { MustInsertModule(ctx, t, testDB, m) // Change the module, and re-insert. m.IsRedistributable = !m.IsRedistributable - m.Licenses[0].Contents = append(m.Licenses[0].Contents, " and more"...) + lic := *m.Licenses[0] + lic.Contents = append(lic.Contents, " and more"...) + sample.ReplaceLicense(m, &lic) m.Units[0].Readme.Contents += " and more" MustInsertModule(ctx, t, testDB, m) |
