(t *testing.T)
| 235 | } |
| 236 | |
| 237 | func TestAttribute(t *testing.T) { |
| 238 | tm := time.Unix(123, 456) |
| 239 | br := blob.MustParse("xxx-1234") |
| 240 | tests := []struct { |
| 241 | bb *Builder |
| 242 | want string |
| 243 | }{ |
| 244 | { |
| 245 | bb: NewSetAttributeClaim(br, "attr1", "val1"), |
| 246 | want: `{"camliVersion": 1, |
| 247 | "attribute": "attr1", |
| 248 | "camliType": "claim", |
| 249 | "claimDate": "1970-01-01T00:02:03.000000456Z", |
| 250 | "claimType": "set-attribute", |
| 251 | "permaNode": "xxx-1234", |
| 252 | "value": "val1" |
| 253 | }`, |
| 254 | }, |
| 255 | { |
| 256 | bb: NewAddAttributeClaim(br, "tag", "funny"), |
| 257 | want: `{"camliVersion": 1, |
| 258 | "attribute": "tag", |
| 259 | "camliType": "claim", |
| 260 | "claimDate": "1970-01-01T00:02:03.000000456Z", |
| 261 | "claimType": "add-attribute", |
| 262 | "permaNode": "xxx-1234", |
| 263 | "value": "funny" |
| 264 | }`, |
| 265 | }, |
| 266 | { |
| 267 | bb: NewDelAttributeClaim(br, "attr1", "val1"), |
| 268 | want: `{"camliVersion": 1, |
| 269 | "attribute": "attr1", |
| 270 | "camliType": "claim", |
| 271 | "claimDate": "1970-01-01T00:02:03.000000456Z", |
| 272 | "claimType": "del-attribute", |
| 273 | "permaNode": "xxx-1234", |
| 274 | "value": "val1" |
| 275 | }`, |
| 276 | }, |
| 277 | { |
| 278 | bb: NewDelAttributeClaim(br, "attr2", ""), |
| 279 | want: `{"camliVersion": 1, |
| 280 | "attribute": "attr2", |
| 281 | "camliType": "claim", |
| 282 | "claimDate": "1970-01-01T00:02:03.000000456Z", |
| 283 | "claimType": "del-attribute", |
| 284 | "permaNode": "xxx-1234" |
| 285 | }`, |
| 286 | }, |
| 287 | { |
| 288 | bb: newClaim(&claimParam{ |
| 289 | permanode: br, |
| 290 | claimType: SetAttributeClaim, |
| 291 | attribute: "foo", |
| 292 | value: "bar", |
| 293 | }, &claimParam{ |
| 294 | permanode: br, |
nothing calls this directly
no test coverage detected