mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
Adding basic pinning tests for insert text
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user