BoostResourcesTest: the guideline stays under 120 lines and verbatim, the skill carries its frontmatter and every guideline section as a chapter, names every --md-sys-*/--md-ref-* token family declared in resources/css/tokens and every M3 breakpoint, and ends with an Attribution chapter. NOTICE records that the rules and wording come from m3.material.io (CC BY 4.0) and the token values from androidx Compose (Apache-2.0), since docs/ is export-ignored and the skill ships. Plan steps 29 and 30. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
93 lines
3.2 KiB
PHP
93 lines
3.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\File;
|
|
use Illuminate\Support\Str;
|
|
|
|
const SKILL_PATH = __DIR__.'/../../resources/boost/skills/livewire-material-development/SKILL.md';
|
|
|
|
it('gives the skill the frontmatter Boost requires', function () {
|
|
$skill = File::get(SKILL_PATH);
|
|
|
|
expect($skill)
|
|
->toStartWith("---\n")
|
|
->toContain("\nname: livewire-material-development\n")
|
|
->toMatch('/\ndescription: \S.+\n/');
|
|
});
|
|
|
|
it('names every component in the skill', function () {
|
|
$skill = File::get(SKILL_PATH);
|
|
|
|
$undocumented = collect(File::allFiles(__DIR__.'/../../resources/views/components'))
|
|
->filter(fn (SplFileInfo $file): bool => str_ends_with($file->getFilename(), '.blade.php'))
|
|
->map(fn (SplFileInfo $file): string => Str::of($file->getRelativePathname())
|
|
->beforeLast('.blade.php')
|
|
->replace(DIRECTORY_SEPARATOR, '.')
|
|
->toString())
|
|
->reject(fn (string $component): bool => str_contains($skill, "<x-{$component}"))
|
|
->values();
|
|
|
|
expect($undocumented)->toBeEmpty();
|
|
});
|
|
|
|
const GUIDELINE_PATH = __DIR__.'/../../resources/boost/guidelines/material-3.blade.php';
|
|
const DESIGN_SKILL_PATH = __DIR__.'/../../resources/boost/skills/material-3-design/SKILL.md';
|
|
|
|
it('keeps the Material 3 guideline short, verbatim and always on', function () {
|
|
$guideline = File::get(GUIDELINE_PATH);
|
|
|
|
expect($guideline)
|
|
->toStartWith("@verbatim\n")
|
|
->toContain("\n@endverbatim")
|
|
->toContain("\n## Material 3\n");
|
|
|
|
// Boost inlines every guideline into every session, so this one must stay a page.
|
|
expect(substr_count($guideline, "\n"))->toBeLessThan(120);
|
|
});
|
|
|
|
it('gives the design skill the frontmatter Boost requires', function () {
|
|
$skill = File::get(DESIGN_SKILL_PATH);
|
|
|
|
expect($skill)
|
|
->toStartWith("---\n")
|
|
->toContain("\nname: material-3-design\n")
|
|
->toMatch('/\ndescription: \S.+\n/');
|
|
});
|
|
|
|
it('carries every guideline section in the design skill', function () {
|
|
preg_match_all('/^### (.+)$/m', File::get(GUIDELINE_PATH), $sections);
|
|
preg_match_all('/^## (.+)$/m', File::get(DESIGN_SKILL_PATH), $chapters);
|
|
|
|
expect($sections[1])->not->toBeEmpty();
|
|
expect(array_values(array_diff($sections[1], $chapters[1])))->toBe([]);
|
|
});
|
|
|
|
it('names every token family and breakpoint in the design skill', function () {
|
|
$skill = File::get(DESIGN_SKILL_PATH);
|
|
|
|
$families = collect(File::files(__DIR__.'/../../resources/css/tokens'))
|
|
->flatMap(function (SplFileInfo $file): array {
|
|
preg_match_all('/--md-(?:sys|ref)-[a-z]+-/', $file->getContents(), $matches);
|
|
|
|
return $matches[0];
|
|
})
|
|
->unique()
|
|
->values();
|
|
|
|
expect($families)->not->toBeEmpty();
|
|
|
|
foreach ($families as $family) {
|
|
expect($skill)->toContain($family.'*');
|
|
}
|
|
|
|
foreach (['medium', 'expanded', 'large', 'extra-large'] as $breakpoint) {
|
|
expect($skill)->toContain("`{$breakpoint}:`");
|
|
}
|
|
});
|
|
|
|
it('attributes the design skill to Google', function () {
|
|
expect(File::get(DESIGN_SKILL_PATH))
|
|
->toContain("\n## Attribution\n")
|
|
->toContain('Creative Commons Attribution 4.0')
|
|
->toContain('Apache License 2.0');
|
|
});
|