Adding basic pinning tests for insert text

This commit is contained in:
Matt Bierner
2018-11-20 16:36:05 -08:00
parent ec3cba2661
commit ece1bad312

View File

@@ -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');
});
});