Skip to content

Commit 02d189a

Browse files
committed
Add LazyBreadcrumbTest feature tests for component rendering, artisan command, facade resolution, and route macro registration.
1 parent 8630d30 commit 02d189a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Route;
4+
use Step2dev\LazyBreadcrumb\Breadcrumbs as BreadcrumbsGenerator;
5+
use Step2Dev\LazyBreadcrumb\Facades\LazyBreadcrumb;
6+
use Step2Dev\LazyBreadcrumb\View\Components\Breadcrumbs;
7+
use Step2Dev\LazyBreadcrumb\View\Components\BreadcrumbsJsonLd;
8+
9+
it('renders the blade components', function () {
10+
$breadcrumbsComponent = new Breadcrumbs();
11+
$jsonLdComponent = new BreadcrumbsJsonLd([]);
12+
13+
expect($breadcrumbsComponent->render())->not()->toBeNull()
14+
->and($jsonLdComponent->render())->not()->toBeNull();
15+
});
16+
17+
it('runs the test artisan command', function () {
18+
$this
19+
->artisan('breadcrumbs:test')
20+
->assertExitCode(0);
21+
});
22+
23+
it('resolves the facade', function () {
24+
expect(LazyBreadcrumb::class)->toBeString()
25+
->and(app(LazyBreadcrumb::class))->toBeInstanceOf(BreadcrumbsGenerator::class);
26+
});
27+
28+
it('registers route macro', function () {
29+
Route::breadcrumbs(function () {
30+
return ['Dashboard'];
31+
});
32+
33+
expect(Route::getMacro('breadcrumbs'))->not()->toBeNull();
34+
});

0 commit comments

Comments
 (0)