-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add applyInstantJson build action for form filling #14
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
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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import fs, { Stats } from 'fs' | ||
| import { Readable } from 'stream' | ||
| import { AiRedactArgsSchema, Instructions, SignatureOptions } from '../src/schemas.js' | ||
| import { AiRedactArgsSchema, BuildActionSchema, Instructions, SignatureOptions } from '../src/schemas.js' | ||
| import { config as dotenvConfig } from 'dotenv' | ||
| import { performBuildCall } from '../src/dws/build.js' | ||
| import { performSignCall } from '../src/dws/sign.js' | ||
|
|
@@ -40,6 +40,20 @@ function createMockStream(content: string | Buffer): Readable { | |
| return readable | ||
| } | ||
|
|
||
| describe('BuildActionSchema', () => { | ||
| it('should parse applyInstantJson actions', () => { | ||
| const result = BuildActionSchema.safeParse({ type: 'applyInstantJson', file: '/test.json' }) | ||
|
|
||
| expect(result.success).toBe(true) | ||
| }) | ||
|
|
||
| it('should reject applyInstantJson actions without a file', () => { | ||
| const result = BuildActionSchema.safeParse({ type: 'applyInstantJson' }) | ||
|
|
||
| expect(result.success).toBe(false) | ||
| }) | ||
| }) | ||
|
Comment on lines
+43
to
+55
|
||
|
|
||
| describe('API Functions', () => { | ||
| const originalEnv = process.env | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The schema is correctly defined and follows the same pattern as ApplyXfdfActionSchema. However, the implementation is incomplete. The src/dws/build.ts file needs to be updated to handle applyInstantJson actions with local file references. Without this update, applyInstantJson will only work with URLs, not local files. The processActionFileReferences function in build.ts should include a condition similar to the one for applyXfdf to process the file reference.