Skip to content
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

[TestGru] Add unit test for app/lib/common/prompts/prompts.ts #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions app/lib/common/prompts/prompts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest';
import { getSystemPrompt, CONTINUE_PROMPT } from './prompts';
import { MODIFICATIONS_TAG_NAME, WORK_DIR } from '~/utils/constants';

describe('prompts', () => {
describe('getSystemPrompt', () => {
it('should return system prompt with default work dir', () => {
const prompt = getSystemPrompt();
expect(prompt).toContain(`The current working directory is \`${WORK_DIR}\`.`);
expect(prompt).toContain(MODIFICATIONS_TAG_NAME);
expect(prompt).toContain('You are Bolt, an expert AI assistant');
});

it('should return system prompt with custom work dir', () => {
const customDir = '/custom/dir';
const prompt = getSystemPrompt(customDir);
expect(prompt).toContain(`The current working directory is \`${customDir}\`.`);
});
});

describe('CONTINUE_PROMPT', () => {
it('should contain continue instructions', () => {
expect(CONTINUE_PROMPT).toContain('Continue your prior response');
expect(CONTINUE_PROMPT).toContain('Do not repeat any content');
});
});
});
Loading