(badge)
| 50 | } |
| 51 | |
| 52 | expectBadge(badge) { |
| 53 | const expectedKeys = [ |
| 54 | 'label', |
| 55 | 'message', |
| 56 | 'logoWidth', |
| 57 | 'labelColor', |
| 58 | 'color', |
| 59 | 'link', |
| 60 | ] |
| 61 | |
| 62 | for (const key of Object.keys(badge)) { |
| 63 | if (!expectedKeys.includes(key)) { |
| 64 | throw new Error(`Found unexpected object key '${key}'`) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | return this.afterJSON(json => { |
| 69 | this.constructor._expectField(json, 'label', badge.label) |
| 70 | this.constructor._expectField(json, 'message', badge.message) |
| 71 | this.constructor._expectField(json, 'logoWidth', badge.logoWidth) |
| 72 | this.constructor._expectField(json, 'labelColor', badge.labelColor) |
| 73 | this.constructor._expectField(json, 'color', badge.color) |
| 74 | this.constructor._expectField(json, 'link', badge.link) |
| 75 | }) |
| 76 | } |
| 77 | |
| 78 | expectRedirect(location) { |
| 79 | return this.expectStatus(301).expectHeader('Location', location) |
no test coverage detected