From 6ccb77a5adb1d2997e3e265c08a0892d081dee0f Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 30 Jan 2021 19:17:05 -0600 Subject: [PATCH] add test for snippets --- src/editor/snippets.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/editor/snippets.test.ts diff --git a/src/editor/snippets.test.ts b/src/editor/snippets.test.ts new file mode 100644 index 00000000..5ddf13cb --- /dev/null +++ b/src/editor/snippets.test.ts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +// Copyright (c) 2021 The Pybricks Authors + +import ace from 'ace-builds'; + +import './snippets'; + +type Snippets = { + snippetText: string; + scope: string; +}; + +it('indents with tabs', () => { + const { snippetText, scope } = ace.require('ace/snippets/python') as Snippets; + + expect(scope).toBe('python'); + + for (const line of snippetText.split('\n')) { + expect(line).not.toMatch(/^(\t* )+\t*/); + } +});