LibreChat/packages/data-provider/src/pullRequest.spec.ts
Marco Beretta 22b1d4f966
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
🌿 feat: Accept Lane Git State and Pull Request Contract- #16792 (#16792)
Code workers can report the branch and head commit of the lane a command ran in. LibreChat now accepts an optional laneGit key on execute_command results, bounded to a 256 character branch without control characters and a 40 or 64 character lowercase hex head, and rejects anything else. The data-provider gains the pull request types, endpoint, query key and service method, and an endpoints.agents.pullRequests config block that is off by default and takes the token only as an environment variable reference.
2026-10-06 00:02:25 +02:00

26 lines
1.1 KiB
TypeScript

import { PULL_REQUEST_CHECKS, PULL_REQUEST_MERGEABLE, PULL_REQUEST_STATES } from './types';
import { conversationPullRequest } from './api-endpoints';
import { QueryKeys } from './keys';
describe('conversation pull request contract', () => {
it('builds the endpoint under the conversation', () => {
expect(conversationPullRequest('abc-123')).toBe('/api/convos/abc-123/pull-request');
});
it('encodes a conversation id so it cannot change the path or query', () => {
const endpoint = conversationPullRequest('a/b?c=d#e');
expect(endpoint).toBe('/api/convos/a%2Fb%3Fc%3Dd%23e/pull-request');
expect(endpoint).not.toContain('?');
expect(endpoint).not.toContain('#');
});
it('has its own query key', () => {
expect(QueryKeys.conversationPullRequest).toBe('conversationPullRequest');
});
it('lists every state the header can render', () => {
expect([...PULL_REQUEST_STATES]).toEqual(['open', 'closed', 'merged']);
expect([...PULL_REQUEST_MERGEABLE]).toEqual(['clean', 'conflicting', 'unknown']);
expect([...PULL_REQUEST_CHECKS]).toEqual(['passing', 'failing', 'running', 'none']);
});
});