-
Notifications
You must be signed in to change notification settings - Fork 2
Stop shipping a mock API to users, and stop fixtures being tidier than the real one #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2fd5c8d
Retire fixture mode, and stop fixtures being tidier than the API
wmadden-electric 0a37e5a
Delete the dead helpers the linter had merely renamed, and the guard …
wmadden-electric 31654bb
Give renderAuthSuccess its own tests, since retiring fixture mode too…
wmadden-electric 375a459
Type the Git endpoints from the SDK, instead of casting past it to a …
wmadden-electric File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /** | ||
| * The agent commands install and report Prisma's skills for local | ||
| * coding agents. They touch no management API — they run the `skills` | ||
| * CLI and write files into the working directory — but they ship in the | ||
| * binary, so they get the same real happy path as everything else. | ||
| * | ||
| * Each runs in a throwaway working directory, so the files they write | ||
| * belong to the run and go with it. | ||
| */ | ||
| import { existsSync } from "node:fs"; | ||
| import path from "node:path"; | ||
|
|
||
| import { beforeAll, expect, it } from "vitest"; | ||
|
|
||
| import { describeCommand, session } from "./suite"; | ||
|
|
||
| interface StatusResult { | ||
| readonly skillsInstalled: boolean; | ||
| readonly skillsLockInstalled: boolean; | ||
| readonly skillsLockPath: string; | ||
| readonly statusScope: string; | ||
| } | ||
|
|
||
| interface OperationResult { | ||
| readonly operation: string; | ||
| readonly skills: { readonly status: string }; | ||
| } | ||
|
|
||
| /** Shared so `status` can be asked before and after `install`, which is | ||
| * what shows the install did something. */ | ||
| let workdir: string; | ||
| let installedBefore: StatusResult | undefined; | ||
|
|
||
| beforeAll(async () => { | ||
| const cli = await session(); | ||
| workdir = await cli.workdir(); | ||
| installedBefore = (await cli.run(["agent", "status"], { cwd: workdir })) | ||
| .envelope.result as StatusResult; | ||
| }); | ||
|
|
||
| describeCommand("agent status", () => { | ||
| it("reports nothing installed in a fresh directory", async () => { | ||
| expect(installedBefore?.statusScope).toBe("project"); | ||
| expect(installedBefore?.skillsInstalled).toBe(false); | ||
| expect(installedBefore?.skillsLockInstalled).toBe(false); | ||
| expect(installedBefore?.skillsLockPath).toBe("skills-lock.json"); | ||
| }); | ||
| }); | ||
|
|
||
| describeCommand("agent install", () => { | ||
| it("installs the skills and writes the lock file", async () => { | ||
| const cli = await session(); | ||
| const run = await cli.run(["agent", "install"], { cwd: workdir }); | ||
| const result = run.envelope.result as OperationResult; | ||
|
|
||
| expect(result.operation).toBe("install"); | ||
| expect(result.skills.status).toBe("installed"); | ||
| // The command's own answer is not the whole story: the lock file it | ||
| // claims to write has to be there. | ||
| expect(existsSync(path.join(workdir, "skills-lock.json"))).toBe(true); | ||
|
|
||
| const after = (await cli.run(["agent", "status"], { cwd: workdir })) | ||
| .envelope.result as StatusResult; | ||
| expect(after.skillsLockInstalled).toBe(true); | ||
| expect(after.skillsInstalled).toBe(true); | ||
| }); | ||
| }); | ||
|
|
||
| describeCommand("agent update", () => { | ||
| it("updates the skills already installed", async () => { | ||
| const cli = await session(); | ||
| // Its own directory and its own install: depending on the block | ||
| // above would make this pass or fail on test order, and a focused | ||
| // run would find an empty directory. | ||
| const cwd = await cli.workdir(); | ||
| await cli.run(["agent", "install"], { cwd }); | ||
|
|
||
| const run = await cli.run(["agent", "update"], { cwd }); | ||
| const result = run.envelope.result as OperationResult; | ||
|
|
||
| expect(result.operation).toBe("update"); | ||
| expect(result.skills.status).toBe("installed"); | ||
| expect(existsSync(path.join(cwd, "skills-lock.json"))).toBe(true); | ||
| }); | ||
| }); | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.