MCPcopy Create free account
hub / github.com/cli/cli / TestNewAsset

Function TestNewAsset

internal/attachments/userasset_test.go:26–255  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func TestNewAsset(t *testing.T) {
27 tests := []struct {
28 name string
29 file string
30 size int64
31 setup func(t *testing.T)
32 path string
33 alt string
34 wantPath string
35 wantAlt string
36 wantContentType string
37 wantErr string
38 }{
39 {
40 name: "png",
41 file: "shot.png",
42 path: "./shot.png",
43 wantAlt: "shot",
44 wantContentType: "image/png",
45 },
46 {
47 name: "jpg",
48 file: "shot.jpg",
49 path: "./shot.jpg",
50 wantAlt: "shot",
51 wantContentType: "image/jpeg",
52 },
53 {
54 name: "jpeg",
55 file: "shot.jpeg",
56 path: "./shot.jpeg",
57 wantAlt: "shot",
58 wantContentType: "image/jpeg",
59 },
60 {
61 name: "gif",
62 file: "shot.gif",
63 path: "./shot.gif",
64 wantAlt: "shot",
65 wantContentType: "image/gif",
66 },
67 {
68 name: "webp",
69 file: "shot.webp",
70 path: "./shot.webp",
71 wantAlt: "shot",
72 wantContentType: "image/webp",
73 },
74 {
75 name: "svg",
76 file: "shot.svg",
77 path: "./shot.svg",
78 wantAlt: "shot",
79 wantContentType: "image/svg+xml",
80 },
81 {
82 // A video has no alt attribute to fill, so the author cannot supply
83 // one. The filename stands in, extension included, because it

Callers

nothing calls this directly

Calls 7

newAssetFunction · 0.85
SkipMethod · 0.80
EqualMethod · 0.80
writeFileFunction · 0.70
RunMethod · 0.65
PathMethod · 0.65
getAssetMethod · 0.65

Tested by

no test coverage detected