-
Notifications
You must be signed in to change notification settings - Fork 3.7k
v0.7.31: sidebar shortcut, env var expansion in lifecycle triggers, ashby fixes #5622
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
5 commits
Select commit
Hold shift + click to select a range
1fe94d3
feat(sidebar): add Cmd+B shortcut to toggle sidebar collapse (#5618)
waleedlatif1 f9b09ec
fix(webhooks): resolve env var references before deploy-triggered sub…
waleedlatif1 5dec4f3
fix(ashby): parse alternateEmailAddresses and socialLinks into arrays…
waleedlatif1 b20bbdc
fix(global-commands): use isContentEditable for the editable guard (#…
waleedlatif1 29cf3e7
fix(ashby): fail loudly instead of silently dropping malformed social…
waleedlatif1 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
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
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,96 @@ | ||
| /** | ||
| * @vitest-environment node | ||
| */ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AshbyBlock } from './ashby' | ||
|
|
||
| describe('AshbyBlock', () => { | ||
| const buildParams = (operation: string, extra: Record<string, unknown>) => ({ | ||
| operation, | ||
| ...extra, | ||
| }) | ||
|
|
||
| describe('alternateEmailAddresses parsing (create_candidate)', () => { | ||
| it('parses a comma-separated string into an array', () => { | ||
| const result = AshbyBlock.tools.config.params!( | ||
| buildParams('create_candidate', { | ||
| alternateEmailAddresses: 'a@x.com, b@x.com', | ||
| }) | ||
| ) | ||
| expect(result.alternateEmailAddresses).toEqual(['a@x.com', 'b@x.com']) | ||
| }) | ||
|
|
||
| it('parses a JSON array string into an array', () => { | ||
| const result = AshbyBlock.tools.config.params!( | ||
| buildParams('create_candidate', { | ||
| alternateEmailAddresses: '["a@x.com","b@x.com"]', | ||
| }) | ||
| ) | ||
| expect(result.alternateEmailAddresses).toEqual(['a@x.com', 'b@x.com']) | ||
| }) | ||
|
|
||
| it('omits the field entirely when empty', () => { | ||
| const result = AshbyBlock.tools.config.params!( | ||
| buildParams('create_candidate', { alternateEmailAddresses: '' }) | ||
| ) | ||
| expect(result.alternateEmailAddresses).toBeUndefined() | ||
| }) | ||
| }) | ||
|
|
||
| describe('socialLinks parsing (update_candidate)', () => { | ||
| it('parses a JSON array of link objects', () => { | ||
| const result = AshbyBlock.tools.config.params!( | ||
| buildParams('update_candidate', { | ||
| socialLinks: '[{"type":"Twitter","url":"https://twitter.com/jane"}]', | ||
| }) | ||
| ) | ||
| expect(result.socialLinks).toEqual([{ type: 'Twitter', url: 'https://twitter.com/jane' }]) | ||
| }) | ||
|
|
||
| it('throws instead of silently dropping the field when the JSON is malformed', () => { | ||
| // A silent [] here would let the Ashby update proceed without applying | ||
| // the requested links and with no error shown to the workflow author. | ||
| expect(() => | ||
| AshbyBlock.tools.config.params!( | ||
| buildParams('update_candidate', { socialLinks: 'not json' }) | ||
| ) | ||
| ).toThrow(/Invalid JSON in Ashby social links/) | ||
| }) | ||
|
|
||
| it('throws when the parsed JSON is not an array', () => { | ||
| expect(() => | ||
| AshbyBlock.tools.config.params!( | ||
| buildParams('update_candidate', { socialLinks: '{"type":"Twitter"}' }) | ||
| ) | ||
| ).toThrow(/expected a JSON array/) | ||
| }) | ||
| }) | ||
|
|
||
| describe('wandConfig on array-shaped fields', () => { | ||
| it('does not request object-wrapped output for alternateEmailAddresses or socialLinks', () => { | ||
| // generationType 'json-object' makes the wand API append "the response | ||
| // must start with { and end with }", which conflicts with these fields' | ||
| // array-or-comma-separated parsers (parseStringListInput/parseSocialLinksInput). | ||
| const alternateEmailAddresses = AshbyBlock.subBlocks.find( | ||
| (s) => s.id === 'alternateEmailAddresses' | ||
| ) | ||
| const socialLinks = AshbyBlock.subBlocks.find((s) => s.id === 'socialLinks') | ||
| expect(alternateEmailAddresses?.wandConfig?.generationType).not.toBe('json-object') | ||
| expect(socialLinks?.wandConfig?.generationType).not.toBe('json-object') | ||
| }) | ||
| }) | ||
|
|
||
| describe('list_applications candidateId filter', () => { | ||
| it('has no filterCandidateId subBlock or wiring', () => { | ||
| // Ashby's application.list endpoint silently ignores a candidateId | ||
| // body field (confirmed live: passing a nonexistent candidate UUID | ||
| // still returns unfiltered results) — the correct path for a | ||
| // candidate's applications is ashby_get_candidate's applicationIds. | ||
| expect(AshbyBlock.subBlocks.find((s) => s.id === 'filterCandidateId')).toBeUndefined() | ||
| const result = AshbyBlock.tools.config.params!( | ||
| buildParams('list_applications', { filterCandidateId: 'some-id' }) | ||
| ) | ||
| expect(result.candidateId).toBeUndefined() | ||
| }) | ||
| }) | ||
| }) |
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.