From 25b9d4354f7ae2771aa3a32188c3e1e749dcd032 Mon Sep 17 00:00:00 2001 From: idillon Date: Wed, 22 Nov 2023 11:05:58 -0500 Subject: [PATCH] Refactor: Move 'delay' of integration tests to 'utils' folder --- integration-tests/src/tests/bitbake-commands.test.ts | 5 +---- integration-tests/src/tests/bitbake-parse.test.ts | 5 +---- integration-tests/src/tests/completion.test.ts | 5 +---- integration-tests/src/tests/hover.test.ts | 5 +---- integration-tests/src/tests/vscode-integration.test.ts | 5 +---- integration-tests/src/utils/async.ts | 8 ++++++++ 6 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 integration-tests/src/utils/async.ts diff --git a/integration-tests/src/tests/bitbake-commands.test.ts b/integration-tests/src/tests/bitbake-commands.test.ts index a6ab8dc7..a9180ecf 100644 --- a/integration-tests/src/tests/bitbake-commands.test.ts +++ b/integration-tests/src/tests/bitbake-commands.test.ts @@ -6,10 +6,7 @@ import * as assert from 'assert' import * as vscode from 'vscode' import { afterEach } from 'mocha' - -async function delay (ms: number): Promise { - await new Promise(resolve => setTimeout(resolve, ms)) -} +import { delay } from '../utils/async' suite('Bitbake Commands Test Suite', () => { let disposables: vscode.Disposable[] = [] diff --git a/integration-tests/src/tests/bitbake-parse.test.ts b/integration-tests/src/tests/bitbake-parse.test.ts index 6a98e86b..dfc63c35 100644 --- a/integration-tests/src/tests/bitbake-parse.test.ts +++ b/integration-tests/src/tests/bitbake-parse.test.ts @@ -9,10 +9,7 @@ import { afterEach } from 'mocha' import path from 'path' import { addLayer, resetLayer } from '../utils/bitbake' - -async function delay (ms: number): Promise { - await new Promise(resolve => setTimeout(resolve, ms)) -} +import { delay } from '../utils/async' suite('Bitbake Commands Test Suite', () => { let disposables: vscode.Disposable[] = [] diff --git a/integration-tests/src/tests/completion.test.ts b/integration-tests/src/tests/completion.test.ts index 4c0ed319..1cd29cea 100644 --- a/integration-tests/src/tests/completion.test.ts +++ b/integration-tests/src/tests/completion.test.ts @@ -6,10 +6,7 @@ import * as assert from 'assert' import * as vscode from 'vscode' import path from 'path' - -async function delay (ms: number): Promise { - await new Promise(resolve => setTimeout(resolve, ms)) -} +import { delay } from '../utils/async' suite('Bitbake Completion Test Suite', () => { const filePath = path.resolve(__dirname, '../../project-folder/sources/meta-fixtures/completion.bb') diff --git a/integration-tests/src/tests/hover.test.ts b/integration-tests/src/tests/hover.test.ts index 0d487ff1..deb6b937 100644 --- a/integration-tests/src/tests/hover.test.ts +++ b/integration-tests/src/tests/hover.test.ts @@ -6,10 +6,7 @@ import * as assert from 'assert' import * as vscode from 'vscode' import path from 'path' - -async function delay (ms: number): Promise { - await new Promise(resolve => setTimeout(resolve, ms)) -} +import { delay } from '../utils/async' suite('Bitbake Hover Test Suite', () => { const filePath = path.resolve(__dirname, '../../project-folder/sources/meta-fixtures/hover.bb') diff --git a/integration-tests/src/tests/vscode-integration.test.ts b/integration-tests/src/tests/vscode-integration.test.ts index f72086de..d0aa5570 100644 --- a/integration-tests/src/tests/vscode-integration.test.ts +++ b/integration-tests/src/tests/vscode-integration.test.ts @@ -6,10 +6,7 @@ import * as assert from 'assert' import { after } from 'mocha' import * as vscode from 'vscode' - -async function delay (ms: number): Promise { - await new Promise(resolve => setTimeout(resolve, ms)) -} +import { delay } from '../utils/async' suite('VSCode integration Test Suite', () => { suiteSetup(async function (this: Mocha.Context) { diff --git a/integration-tests/src/utils/async.ts b/integration-tests/src/utils/async.ts new file mode 100644 index 00000000..92c6cad6 --- /dev/null +++ b/integration-tests/src/utils/async.ts @@ -0,0 +1,8 @@ +/* -------------------------------------------------------------------------------------------- + * Copyright (c) 2023 Savoir-faire Linux. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ + +export async function delay (ms: number): Promise { + await new Promise(resolve => setTimeout(resolve, ms)) +}