|
14 | 14 | ->assertOk(); |
15 | 15 | }); |
16 | 16 |
|
| 17 | +it('renders an SVG badge for the overall status page status', function () { |
| 18 | + Component::factory()->create(['status' => ComponentStatusEnum::operational]); |
| 19 | + |
| 20 | + $response = $this->get(route('cachet.status-page.badge')) |
| 21 | + ->assertOk() |
| 22 | + ->assertHeader('content-type', 'image/svg+xml; charset=UTF-8') |
| 23 | + ->assertSee('<svg', escape: false) |
| 24 | + ->assertSee('All systems are operational.'); |
| 25 | + |
| 26 | + expect($response->headers->get('cache-control')) |
| 27 | + ->toContain('public') |
| 28 | + ->toContain('max-age=60') |
| 29 | + ->toContain('s-maxage=60'); |
| 30 | +}); |
| 31 | + |
| 32 | +it('renders an SVG badge for a public component', function () { |
| 33 | + $component = Component::factory()->create([ |
| 34 | + 'name' => 'Public API', |
| 35 | + 'status' => ComponentStatusEnum::major_outage, |
| 36 | + ]); |
| 37 | + |
| 38 | + $this->get(route('cachet.status-page.component.badge', $component)) |
| 39 | + ->assertOk() |
| 40 | + ->assertHeader('content-type', 'image/svg+xml; charset=UTF-8') |
| 41 | + ->assertSee('<svg', escape: false) |
| 42 | + ->assertSee('Public API') |
| 43 | + ->assertSee('Major outage'); |
| 44 | +}); |
| 45 | + |
| 46 | +it('does not render a badge for a component in a private group', function () { |
| 47 | + $group = ComponentGroup::factory()->create(['visible' => 0]); |
| 48 | + $component = Component::factory()->create(['component_group_id' => $group->id]); |
| 49 | + |
| 50 | + $this->get(route('cachet.status-page.component.badge', $component)) |
| 51 | + ->assertNotFound(); |
| 52 | +}); |
| 53 | + |
| 54 | +it('does not render a badge for a disabled component', function () { |
| 55 | + $component = Component::factory()->create(['enabled' => false]); |
| 56 | + |
| 57 | + $this->get(route('cachet.status-page.component.badge', $component)) |
| 58 | + ->assertNotFound(); |
| 59 | +}); |
| 60 | + |
17 | 61 | it('can hide the site name and about content without changing status page metadata', function () { |
18 | 62 | $settings = app(AppSettings::class); |
19 | 63 | $settings->name = 'Acme Status'; |
|
0 commit comments