MCPcopy
hub / github.com/cli/cli / TestExportReleases

Function TestExportReleases

pkg/cmd/release/list/list_test.go:391–411  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

389}
390
391func TestExportReleases(t *testing.T) {
392 ios, _, stdout, _ := iostreams.Test()
393 createdAt, _ := time.Parse(time.RFC3339, "2024-01-01T00:00:00Z")
394 publishedAt, _ := time.Parse(time.RFC3339, "2024-02-01T00:00:00Z")
395 rs := []Release{{
396 Name: "v1",
397 TagName: "tag",
398 IsDraft: true,
399 IsLatest: false,
400 IsPrerelease: true,
401 IsImmutable: true,
402 CreatedAt: createdAt,
403 PublishedAt: publishedAt,
404 }}
405 exporter := cmdutil.NewJSONExporter()
406 exporter.SetFields(releaseFields)
407 require.NoError(t, exporter.Write(ios, rs))
408 require.JSONEq(t,
409 `[{"createdAt":"2024-01-01T00:00:00Z","isDraft":true,"isLatest":false,"isPrerelease":true,"isImmutable":true,"name":"v1","publishedAt":"2024-02-01T00:00:00Z","tagName":"tag"}]`,
410 stdout.String())
411}

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
NewJSONExporterFunction · 0.92
SetFieldsMethod · 0.80
WriteMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected