|
1 | | -import { assertExists } from "https://deno.land/std@0.206.0/assert/assert_exists.ts"; |
2 | | -import { Downloader } from "./downloader.ts"; |
3 | | -import { removeStackQLDownload } from "../../testing/utils.ts"; |
| 1 | +import { assertExists } from 'https://deno.land/std@0.206.0/assert/assert_exists.ts' |
| 2 | +import { Downloader } from './downloader.ts' |
| 3 | +import { removeStackQLDownload } from '../../testing/utils.ts' |
4 | 4 | import { |
5 | | - assertSpyCalls, |
6 | | - spy, |
7 | | -} from "https://deno.land/std@0.207.0/testing/mock.ts"; |
| 5 | + assertSpyCalls, |
| 6 | + spy, |
| 7 | +} from 'https://deno.land/std@0.207.0/testing/mock.ts' |
8 | 8 |
|
9 | | -Deno.test("Downloader setupStackQL and upgrade Test", async () => { |
10 | | - // Arrange |
11 | | - await removeStackQLDownload(); |
12 | | - const downloader = new Downloader(); |
13 | | - let binaryPath: string; |
14 | | - const denoOpenSpy = spy(Deno, "open"); |
| 9 | +Deno.test('Downloader setupStackQL and upgrade Test', async () => { |
| 10 | + // Arrange |
| 11 | + await removeStackQLDownload() |
| 12 | + const downloader = new Downloader() |
| 13 | + let binaryPath: string |
| 14 | + const denoOpenSpy = spy(Deno, 'open') |
15 | 15 |
|
16 | | - // Act |
17 | | - const setupTest = async () => { |
18 | | - try { |
19 | | - binaryPath = await downloader.setupStackQL(); |
| 16 | + // Act |
| 17 | + const setupTest = async () => { |
| 18 | + try { |
| 19 | + binaryPath = await downloader.setupStackQL() |
20 | 20 |
|
21 | | - // Assert |
22 | | - assertExists(binaryPath); |
23 | | - assertSpyCalls(denoOpenSpy, 1); |
24 | | - // Check if the binary exists after setupStackQL is called |
| 21 | + // Assert |
| 22 | + assertExists(binaryPath) |
| 23 | + assertSpyCalls(denoOpenSpy, 1) |
| 24 | + // Check if the binary exists after setupStackQL is called |
25 | 25 |
|
26 | | - console.log( |
27 | | - "Test passed: setupStackQL completed without errors and binary exists." |
28 | | - ); |
29 | | - } catch (error) { |
30 | | - console.error("Test failed:", error); |
31 | | - throw error; // This will cause the test to fail |
32 | | - } |
33 | | - }; |
| 26 | + console.log( |
| 27 | + 'Test passed: setupStackQL completed without errors and binary exists.', |
| 28 | + ) |
| 29 | + } catch (error) { |
| 30 | + console.error('Test failed:', error) |
| 31 | + throw error // This will cause the test to fail |
| 32 | + } |
| 33 | + } |
34 | 34 |
|
35 | | - const upgradeTest = async () => { |
36 | | - try { |
37 | | - binaryPath = await downloader.upgradeStackQL(); |
| 35 | + const upgradeTest = async () => { |
| 36 | + try { |
| 37 | + binaryPath = await downloader.upgradeStackQL() |
38 | 38 |
|
39 | | - assertExists(binaryPath); |
40 | | - assertSpyCalls(denoOpenSpy, 2); |
41 | | - } catch (error) { |
42 | | - console.error("Test failed:", error); |
43 | | - throw error; // This will cause the test to fail |
44 | | - } |
45 | | - }; |
| 39 | + assertExists(binaryPath) |
| 40 | + assertSpyCalls(denoOpenSpy, 2) |
| 41 | + } catch (error) { |
| 42 | + console.error('Test failed:', error) |
| 43 | + throw error // This will cause the test to fail |
| 44 | + } |
| 45 | + } |
46 | 46 |
|
47 | | - await setupTest(); |
48 | | - await upgradeTest(); |
49 | | -}); |
| 47 | + await setupTest() |
| 48 | + await upgradeTest() |
| 49 | +}) |
0 commit comments