-
Notifications
You must be signed in to change notification settings - Fork 235
[3/4] feat(scm): add Source Control button for commit message generation #1229
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
base: main
Are you sure you want to change the base?
Changes from all commits
7b5b435
2e6f3a3
f182cd6
518a8fb
2347d47
3f0fc9c
60a82cc
d451339
20cf941
0306ab0
b8f5340
119eccf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // npx vitest run src/__tests__/types.test.ts | ||
|
|
||
| import { contributesSchema } from "../types.js" | ||
|
|
||
| describe("contributes commands schema", () => { | ||
| // Reached through `.shape` so this stays focused on the icon field, without needing a whole | ||
| // valid `contributes` object around it. | ||
| const commandsSchema = contributesSchema.shape.commands | ||
|
|
||
| const command = (icon: unknown) => [ | ||
| { command: "zoo-code.generateCommitMessage", title: "%command.generateCommitMessage.title%", icon }, | ||
| ] | ||
|
|
||
| it("accepts a codicon reference", () => { | ||
| expect(commandsSchema.safeParse(command("$(edit)")).success).toBe(true) | ||
| }) | ||
|
|
||
| // The Source Control button ships a PNG per theme rather than a codicon. This field used to | ||
| // allow only a string, which rejected the manifest outright when generating the nightly build. | ||
| it("accepts a pair of theme-specific icon paths", () => { | ||
| const icon = { light: "assets/icons/panel_light.png", dark: "assets/icons/panel_dark.png" } | ||
|
|
||
| expect(commandsSchema.safeParse(command(icon)).success).toBe(true) | ||
| }) | ||
|
|
||
| it("rejects an icon pair that is missing a theme", () => { | ||
| expect(commandsSchema.safeParse(command({ light: "assets/icons/panel_light.png" })).success).toBe(false) | ||
| }) | ||
| }) | ||
|
|
||
| describe("contributes menus schema", () => { | ||
| const menusSchema = contributesSchema.shape.menus | ||
|
|
||
| it("accepts a grouped menu item", () => { | ||
| const menus = { | ||
| "scm/title": [ | ||
| { | ||
| command: "zoo-code.generateCommitMessage", | ||
| group: "navigation", | ||
| when: "scmProvider == git && !zoo-code.generatingCommitMessage", | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
| expect(menusSchema.safeParse(menus).success).toBe(true) | ||
| }) | ||
|
|
||
| // `commandPalette` items have no group. This field used to be required, which rejected the | ||
| // manifest outright when generating the nightly build. | ||
| it("accepts a menu item with no group", () => { | ||
| const menus = { | ||
| commandPalette: [ | ||
| { command: "zoo-code.stopGeneratingCommitMessage", when: "zoo-code.generatingCommitMessage" }, | ||
| ], | ||
| } | ||
|
|
||
| expect(menusSchema.safeParse(menus).success).toBe(true) | ||
| }) | ||
| }) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.