| import { describe, it } from 'node:test'; |
| import assert from 'node:assert/strict'; |
| import { neutralizeCascadeIdentity } from '../src/handlers/chat.js'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| describe('neutralizeCascadeIdentity', () => { |
| const model = 'claude-opus-4-7'; |
|
|
| it('rewrites first-person identity claims', () => { |
| assert.equal( |
| neutralizeCascadeIdentity('I am Cascade and I will help.', model), |
| `I am ${model} and I will help.` |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity("I'm Cascade, ready to help.", model), |
| `I'm ${model}, ready to help.` |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('Hi! my name is Cascade.', model), |
| `Hi! my name is ${model}.` |
| ); |
| }); |
|
|
| it('rewrites third-person self-reference', () => { |
| assert.equal( |
| neutralizeCascadeIdentity('Cascade is an AI coding assistant built by Windsurf.', model), |
| `${model} is an AI assistant built by Anthropic.` |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('As Cascade, I will check that.', model), |
| `As ${model}, I will check that.` |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('Acting as Cascade, I will check that.', model), |
| `As ${model}, I will check that.` |
| ); |
| }); |
|
|
| it('rewrites provider attribution variants', () => { |
| assert.equal( |
| neutralizeCascadeIdentity('I was developed by Codeium.', model), |
| 'I was developed by Anthropic.' |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('I was created by Windsurf.', model), |
| 'I was created by Anthropic.' |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('I was built by Windsurf.', model), |
| 'I was built by Anthropic.' |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity("Codeium's Cascade can help with that.", model), |
| `${model} can help with that.` |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('Windsurf Cascade is here.', model), |
| `${model} is here.` |
| ); |
| }); |
|
|
| it('rewrites Cascade workspace narration', () => { |
| assert.equal( |
| neutralizeCascadeIdentity("Let me check Cascade's workspace.", model), |
| 'Let me check the workspace.' |
| ); |
| assert.equal( |
| neutralizeCascadeIdentity('I will use the Cascade workspace.', model), |
| 'I will use the workspace.' |
| ); |
| }); |
|
|
| it('leaves unrelated text unchanged', () => { |
| const text = 'The waterfall flows down a cascade of rocks.'; |
| assert.equal(neutralizeCascadeIdentity(text, model), text); |
| }); |
|
|
| it('returns text unchanged when modelName has no known provider mapping', () => { |
| const text = 'I am Cascade.'; |
| assert.equal(neutralizeCascadeIdentity(text, 'mystery-model'), text); |
| }); |
|
|
| it('returns falsy inputs unchanged', () => { |
| assert.equal(neutralizeCascadeIdentity('', model), ''); |
| assert.equal(neutralizeCascadeIdentity(null, model), null); |
| assert.equal(neutralizeCascadeIdentity('I am Cascade.', null), 'I am Cascade.'); |
| }); |
| }); |
|
|