Skip to content

Commit

Permalink
remove duplicate test case
Browse files Browse the repository at this point in the history
  • Loading branch information
hitesh-1997 committed Mar 5, 2025
1 parent 2f4bd01 commit c063d8f
Showing 1 changed file with 0 additions and 60 deletions.
60 changes: 0 additions & 60 deletions vscode/src/edit/output/response-transformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,66 +63,6 @@ describe('Smart Apply Response Extraction', () => {
})
})

// Since extractSmartApplyCustomModelResponse is not exported, we'll need to test it through the responseTransformer
describe('Smart Apply Response Extraction', () => {
const createTask = (intent: string, model: string) =>
({
...RESPONSE_TEST_FIXTURES.clean.task,
intent,
model,
}) as any

it('should extract code between smart apply tags for valid input', () => {
const text = `<${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>const x = 1;</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>`
const task = createTask('smartApply', SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault)

const result = responseTransformer(text, task, true)
expect(result).toBe('const x = 1;')
})

it('should return original text when intent is not smartApply', () => {
const text = `<${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>const x = 1;</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>`
const task = createTask('edit', SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault)

const result = responseTransformer(text, task, true)
expect(result).toBe(text)
})

it('should return original text when model is not smart apply model', () => {
const text = `<${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>const x = 1;</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>`
const task = createTask('smartApply', 'gpt-4')

const result = responseTransformer(text, task, true)
expect(result).toBe(text)
})

it('should return original text when tags are not properly placed', () => {
const text = `some text <${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>const x = 1;</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}> more text`
const task = createTask('smartApply', SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault)

const result = responseTransformer(text, task, true)
expect(result).toBe(text)
})

it('should handle nested tags and extract outermost content', () => {
const text = `<${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>outer <${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>inner</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}> content</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>`
const task = createTask('smartApply', SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault)

const result = responseTransformer(text, task, true)
expect(result).toBe(
`outer <${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>inner</${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}> content`
)
})

it('should handle empty content between tags', () => {
const text = `<${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}></${SMART_APPLY_CUSTOM_PROMPT_TOPICS.FINAL_CODE}>`
const task = createTask('smartApply', SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault)

const result = responseTransformer(text, task, true)
expect(result).toBe('')
})
})

describe('responseTransformer', () => {
describe.each(Object.entries(RESPONSE_TEST_FIXTURES))(
'responseTransformer with %s',
Expand Down

0 comments on commit c063d8f

Please sign in to comment.