From ae8ad11ccd98c61dd626703921ce2d59bb340934 Mon Sep 17 00:00:00 2001 From: "gru-agent[bot]" <185149714+gru-agent[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 19:41:24 +0000 Subject: [PATCH] Add unit tests for prompts functionality in prompts.test.ts --- app/lib/common/prompts/prompts.test.ts | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 app/lib/common/prompts/prompts.test.ts diff --git a/app/lib/common/prompts/prompts.test.ts b/app/lib/common/prompts/prompts.test.ts new file mode 100644 index 000000000..b427a8375 --- /dev/null +++ b/app/lib/common/prompts/prompts.test.ts @@ -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'); + }); + }); +});