(t *testing.T)
| 143 | } |
| 144 | |
| 145 | func TestBuildRequestsBulletOperations(t *testing.T) { |
| 146 | tests := []struct { |
| 147 | name string |
| 148 | options Options |
| 149 | wantPreset string |
| 150 | wantDelete bool |
| 151 | }{ |
| 152 | {name: "bullets", options: Options{Bullets: true}, wantPreset: BulletPresetDisc}, |
| 153 | {name: "custom case insensitive", options: Options{BulletPreset: "bullet_checkbox"}, wantPreset: "BULLET_CHECKBOX"}, |
| 154 | {name: "remove", options: Options{ClearBullets: true}, wantDelete: true}, |
| 155 | } |
| 156 | for _, tt := range tests { |
| 157 | t.Run(tt.name, func(t *testing.T) { |
| 158 | requests, err := BuildRequests(tt.options, 1, 5, "") |
| 159 | if err != nil { |
| 160 | t.Fatalf("BuildRequests: %v", err) |
| 161 | } |
| 162 | |
| 163 | if len(requests) != 1 { |
| 164 | t.Fatalf("requests = %#v", requests) |
| 165 | } |
| 166 | |
| 167 | if tt.wantDelete { |
| 168 | if requests[0].DeleteParagraphBullets == nil { |
| 169 | t.Fatalf("missing delete request: %#v", requests[0]) |
| 170 | } |
| 171 | |
| 172 | return |
| 173 | } |
| 174 | |
| 175 | if got := requests[0].CreateParagraphBullets; got == nil || got.BulletPreset != tt.wantPreset { |
| 176 | t.Fatalf("unexpected create request: %#v", requests[0]) |
| 177 | } |
| 178 | }) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | func TestBuildRequestsBulletRemovalPrecedesParagraphControls(t *testing.T) { |
| 183 | requests, err := BuildRequests(Options{ |
nothing calls this directly
no test coverage detected