|
| 1 | +/** |
| 2 | + * User-facing surfaces must advertise `wheels packages add`, not |
| 3 | + * `wheels packages install`. LuCLI intercepts the literal `install` |
| 4 | + * subcommand before Module.cfc runs (#2610, #2706, #3378). |
| 5 | + * |
| 6 | + * Mentions of `install` that explicitly say it is not the verb are fine; |
| 7 | + * copy-to-clipboard snippets and recommended commands are not. |
| 8 | + */ |
| 9 | +component extends="wheels.WheelsTest" { |
| 10 | + |
| 11 | + function run() { |
| 12 | + |
| 13 | + var ctx = {repoRoot: expandPath("/wheels/../..")}; |
| 14 | + |
| 15 | + describe("User-facing surfaces advertise `packages add`", () => { |
| 16 | + |
| 17 | + it("the in-app packages page copies `wheels packages add`", () => { |
| 18 | + var path = expandPath("/wheels/public/views/packagelist.cfm"); |
| 19 | + expect(fileExists(path)).toBeTrue("Missing file: " & path); |
| 20 | + var source = fileRead(path); |
| 21 | + |
| 22 | + expect(source contains "wheels packages add ").toBeTrue( |
| 23 | + "packagelist.cfm copy snippet must use `wheels packages add`." |
| 24 | + ); |
| 25 | + expect(source contains "wheels packages install ").toBeFalse( |
| 26 | + "packagelist.cfm must not put `wheels packages install` in a copy snippet. " |
| 27 | + & "LuCLI intercepts that verb before Module.cfc." |
| 28 | + ); |
| 29 | + }); |
| 30 | + |
| 31 | + it("the packages website copy snippets use `add`, not `install`", () => { |
| 32 | + var files = [ |
| 33 | + ctx.repoRoot & "/web/sites/packages/src/pages/index.astro", |
| 34 | + ctx.repoRoot & "/web/sites/packages/src/pages/[name].astro", |
| 35 | + ctx.repoRoot & "/web/sites/packages/src/components/PackageCard.astro" |
| 36 | + ]; |
| 37 | + var i = 0; |
| 38 | + var n = arrayLen(files); |
| 39 | + for (i = 1; i <= n; i++) { |
| 40 | + expect(fileExists(files[i])).toBeTrue("Missing file: " & files[i]); |
| 41 | + var source = fileRead(files[i]); |
| 42 | + |
| 43 | + // Copy-to-clipboard / recommended command shapes. |
| 44 | + expect(find("wheels packages install {", source) > 0).toBeFalse( |
| 45 | + files[i] & " still has a copy snippet `wheels packages install {name}`. Use `add`." |
| 46 | + ); |
| 47 | + expect(find("wheels packages install <name>", source) > 0).toBeFalse( |
| 48 | + files[i] & " still recommends `wheels packages install <name>`. Use `add`." |
| 49 | + ); |
| 50 | + } |
| 51 | + }); |
| 52 | + |
| 53 | + it("the packages website index recommends `wheels packages add`", () => { |
| 54 | + var path = ctx.repoRoot & "/web/sites/packages/src/pages/index.astro"; |
| 55 | + var source = fileRead(path); |
| 56 | + expect(source contains "wheels packages add <name>").toBeTrue( |
| 57 | + "packages site index should recommend `wheels packages add <name>`." |
| 58 | + ); |
| 59 | + }); |
| 60 | + |
| 61 | + }); |
| 62 | + |
| 63 | + } |
| 64 | + |
| 65 | +} |
0 commit comments