diff options
| author | Julie Qiu <julie@golang.org> | 2019-04-30 17:42:06 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-03-27 16:46:36 -0400 |
| commit | 67ad226e3fd9a449cd7b0f7c8a7dab4134676fec (patch) | |
| tree | f4303796fb3a0b033bd4efc726a9334df76fa6c4 /internal/postgres/postgres_test.go | |
| parent | dc323f1c01d6efb1c441542a30b6e2d199631480 (diff) | |
| download | go-x-pkgsite-67ad226e3fd9a449cd7b0f7c8a7dab4134676fec.tar.xz | |
internal/frontend,internal/postgres: fetch documentation
The following queries have been updated to fetch documentation from the
packages table:
* GetPackage
* GetLatestPackage
* GetVersionForPackage
The documentation tab now displays that data.
Fixes b/131706915
Change-Id: I591f374a355c55b8b937dbf2cfb2de6f105591cd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/456568
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'internal/postgres/postgres_test.go')
| -rw-r--r-- | internal/postgres/postgres_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/postgres/postgres_test.go b/internal/postgres/postgres_test.go index 830ec24a..d029e1c4 100644 --- a/internal/postgres/postgres_test.go +++ b/internal/postgres/postgres_test.go @@ -49,10 +49,11 @@ func sampleVersion(mutators ...func(*internal.Version)) *internal.Version { }, Packages: []*internal.Package{ &internal.Package{ - Name: "foo", - Synopsis: "This is a package synopsis", - Path: "path.to/foo", - Licenses: sampleLicenseInfos, + Name: "foo", + Synopsis: "This is a package synopsis", + Path: "path.to/foo", + Licenses: sampleLicenseInfos, + DocumentationHTML: []byte("This is the documentation HTML"), Imports: []*internal.Import{ &internal.Import{ Name: "bar", @@ -463,9 +464,8 @@ func TestPostgres_GetLatestPackage(t *testing.T) { t.Errorf("testDB.GetLatestPackage(ctx, %q): %v", tc.path, err) } - if diff := cmp.Diff(gotPkg, tc.wantPkg); diff != "" { - t.Errorf("testDB.GetLatestPackage(ctx, %q) mismatch (-got +want):\n%s", - tc.path, diff) + if diff := cmp.Diff(tc.wantPkg, gotPkg, cmpopts.EquateEmpty()); diff != "" { + t.Errorf("testDB.GetLatestPackage(ctx, %q) mismatch (-want +got):\n%s", tc.path, diff) } }) } @@ -1093,7 +1093,7 @@ func TestGetVersionForPackage(t *testing.T) { if err != nil { t.Errorf("testDB.GetVersionForPackage(ctx, %q, %q): %v", tc.path, tc.version, err) } - if diff := cmp.Diff(tc.wantVersion, got); diff != "" { + if diff := cmp.Diff(tc.wantVersion, got, cmpopts.EquateEmpty()); diff != "" { t.Errorf("testDB.GetVersionForPackage(ctx, %q, %q) mismatch (-want +got):\n%s", tc.path, tc.version, diff) } }) |
