(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func TestShouldCopyToClipboard(t *testing.T) { |
| 62 | tests := []struct { |
| 63 | name string |
| 64 | configured string |
| 65 | flagValue *bool |
| 66 | want bool |
| 67 | }{ |
| 68 | { |
| 69 | name: "enabled by default", |
| 70 | want: true, |
| 71 | }, |
| 72 | { |
| 73 | name: "enabled by configuration", |
| 74 | configured: "enabled", |
| 75 | want: true, |
| 76 | }, |
| 77 | { |
| 78 | name: "explicit flag enables disabled configuration", |
| 79 | configured: "disabled", |
| 80 | flagValue: new(true), |
| 81 | want: true, |
| 82 | }, |
| 83 | { |
| 84 | name: "explicit flag disables enabled configuration", |
| 85 | configured: "enabled", |
| 86 | flagValue: new(false), |
| 87 | }, |
| 88 | } |
| 89 | |
| 90 | for _, tt := range tests { |
| 91 | t.Run(tt.name, func(t *testing.T) { |
| 92 | cfg := config.NewMockConfig() |
| 93 | if tt.configured != "" { |
| 94 | cfg.Set("", "clipboard", tt.configured) |
| 95 | } |
| 96 | |
| 97 | require.Equal(t, tt.want, ShouldCopyToClipboard(cfg, tt.flagValue)) |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestShouldUseExpiring(t *testing.T) { |
| 103 | tests := []struct { |
nothing calls this directly
no test coverage detected