diff --git a/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts b/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts index 9cedd07e746..f5da5c7ca19 100644 --- a/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts +++ b/extensions/typescript-language-features/src/test/functionCallSnippet.test.ts @@ -5,10 +5,11 @@ import * as assert from 'assert'; import 'mocha'; +import * as vscode from 'vscode'; import { snippetForFunctionCall } from '../features/completions'; suite('typescript function call snippets', () => { - test('Should use label as name if no display parts are provided', async () => { + test('Should use label as function name', async () => { assert.strictEqual( snippetForFunctionCall( { label: 'abc', }, @@ -17,7 +18,7 @@ suite('typescript function call snippets', () => { 'abc()$0'); }); - test('Should use insertText to override function name if no display parts are provided', async () => { + test('Should use insertText string to override function name', async () => { assert.strictEqual( snippetForFunctionCall( { label: 'abc', insertText: 'def' }, @@ -25,4 +26,22 @@ suite('typescript function call snippets', () => { ).value, 'def()$0'); }); + + test('Should return insertText as-is if it is already a snippet', async () => { + assert.strictEqual( + snippetForFunctionCall( + { label: 'abc', insertText: new vscode.SnippetString('bla()$0') }, + [] + ).value, + 'bla()$0'); + }); + + test('Should return insertText as-is if it is already a snippet', async () => { + assert.strictEqual( + snippetForFunctionCall( + { label: 'abc', insertText: new vscode.SnippetString('bla()$0') }, + [] + ).value, + 'bla()$0'); + }); });