|
2 | 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
3 | 3 | * SPDX-License-Identifier: Apache-2.0 |
4 | 4 | */ |
5 | | -import assert from 'assert' |
6 | | -import sinon from 'sinon' |
7 | | -import { LspController } from 'aws-core-vscode/amazonq' |
8 | | -import { createTestFile } from 'aws-core-vscode/test' |
9 | | -import { fs, Content } from 'aws-core-vscode/shared' |
10 | 5 |
|
11 | | -describe('Amazon Q LSP controller', function () { |
12 | | - it('Download mechanism checks against hash, when hash matches', async function () { |
13 | | - const content = { |
14 | | - filename: 'qserver-linux-x64.zip', |
15 | | - url: 'https://x/0.0.6/qserver-linux-x64.zip', |
16 | | - hashes: [ |
17 | | - 'sha384:768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9', |
18 | | - ], |
19 | | - bytes: 512, |
20 | | - } as Content |
21 | | - const lspController = new LspController() |
22 | | - sinon.stub(lspController, '_download') |
23 | | - const mockFileName = 'test_case_1.zip' |
24 | | - const mockDownloadFile = await createTestFile(mockFileName) |
25 | | - await fs.writeFile(mockDownloadFile.fsPath, 'test') |
26 | | - const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) |
27 | | - assert.strictEqual(result, true) |
28 | | - }) |
| 6 | +// TODO re-enable this file once amazon q context server is migrated to the new interface |
| 7 | +// import assert from 'assert' |
| 8 | +// import sinon from 'sinon' |
| 9 | +// import { LspController } from 'aws-core-vscode/amazonq' |
| 10 | +// import { createTestFile } from 'aws-core-vscode/test' |
| 11 | +// import { fs, Content } from 'aws-core-vscode/shared' |
29 | 12 |
|
30 | | - it('Download mechanism checks against hash, when hash does not match', async function () { |
31 | | - const content = { |
32 | | - filename: 'qserver-linux-x64.zip', |
33 | | - url: 'https://x/0.0.6/qserver-linux-x64.zip', |
34 | | - hashes: [ |
35 | | - 'sha384:38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b', |
36 | | - ], |
37 | | - bytes: 512, |
38 | | - } as Content |
39 | | - const lspController = new LspController() |
40 | | - sinon.stub(lspController, '_download') |
41 | | - const mockFileName = 'test_case_2.zip' |
42 | | - const mockDownloadFile = await createTestFile(mockFileName) |
43 | | - await fs.writeFile(mockDownloadFile.fsPath, 'file_content') |
44 | | - const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) |
45 | | - assert.strictEqual(result, false) |
46 | | - }) |
| 13 | +// describe('Amazon Q LSP controller', function () { |
| 14 | +// it('Download mechanism checks against hash, when hash matches', async function () { |
| 15 | +// const content = { |
| 16 | +// filename: 'qserver-linux-x64.zip', |
| 17 | +// url: 'https://x/0.0.6/qserver-linux-x64.zip', |
| 18 | +// hashes: [ |
| 19 | +// 'sha384:768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9', |
| 20 | +// ], |
| 21 | +// bytes: 512, |
| 22 | +// } as Content |
| 23 | +// const lspController = new LspController() |
| 24 | +// sinon.stub(lspController, '_download') |
| 25 | +// const mockFileName = 'test_case_1.zip' |
| 26 | +// const mockDownloadFile = await createTestFile(mockFileName) |
| 27 | +// await fs.writeFile(mockDownloadFile.fsPath, 'test') |
| 28 | +// const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) |
| 29 | +// assert.strictEqual(result, true) |
| 30 | +// }) |
47 | 31 |
|
48 | | - afterEach(() => { |
49 | | - sinon.restore() |
50 | | - }) |
51 | | -}) |
| 32 | +// it('Download mechanism checks against hash, when hash does not match', async function () { |
| 33 | +// const content = { |
| 34 | +// filename: 'qserver-linux-x64.zip', |
| 35 | +// url: 'https://x/0.0.6/qserver-linux-x64.zip', |
| 36 | +// hashes: [ |
| 37 | +// 'sha384:38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b', |
| 38 | +// ], |
| 39 | +// bytes: 512, |
| 40 | +// } as Content |
| 41 | +// const lspController = new LspController() |
| 42 | +// sinon.stub(lspController, '_download') |
| 43 | +// const mockFileName = 'test_case_2.zip' |
| 44 | +// const mockDownloadFile = await createTestFile(mockFileName) |
| 45 | +// await fs.writeFile(mockDownloadFile.fsPath, 'file_content') |
| 46 | +// const result = await lspController.downloadAndCheckHash(mockDownloadFile.fsPath, content) |
| 47 | +// assert.strictEqual(result, false) |
| 48 | +// }) |
| 49 | + |
| 50 | +// afterEach(() => { |
| 51 | +// sinon.restore() |
| 52 | +// }) |
| 53 | +// }) |
0 commit comments