Skip to content

Commit ba0436d

Browse files
committed
put back test cases
1 parent 957f7c9 commit ba0436d

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed
Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
// /*!
2-
// * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3-
// * SPDX-License-Identifier: Apache-2.0
4-
// */
5-
// import * as sinon from 'sinon'
6-
// import assert from 'assert'
7-
// import { globals } from 'aws-core-vscode/shared'
8-
// import { LspClient } from 'aws-core-vscode/amazonq'
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import * as sinon from 'sinon'
6+
import assert from 'assert'
7+
import { globals } from 'aws-core-vscode/shared'
8+
import { LspClient } from 'aws-core-vscode/amazonq'
99

10-
// describe('Amazon Q LSP client', function () {
11-
// let lspClient: LspClient
12-
// let encryptFunc: sinon.SinonSpy
10+
describe('Amazon Q LSP client', function () {
11+
let lspClient: LspClient
12+
let encryptFunc: sinon.SinonSpy
1313

14-
// beforeEach(async function () {
15-
// sinon.stub(globals, 'isWeb').returns(false)
16-
// lspClient = new LspClient()
17-
// encryptFunc = sinon.spy(lspClient, 'encrypt')
18-
// })
14+
beforeEach(async function () {
15+
sinon.stub(globals, 'isWeb').returns(false)
16+
lspClient = new LspClient()
17+
encryptFunc = sinon.spy(lspClient, 'encrypt')
18+
})
1919

20-
// it('encrypts payload of query ', async () => {
21-
// await lspClient.queryVectorIndex('mock_input')
22-
// assert.ok(encryptFunc.calledOnce)
23-
// assert.ok(encryptFunc.calledWith(JSON.stringify({ query: 'mock_input' })))
24-
// const value = await encryptFunc.returnValues[0]
25-
// // verifies JWT encryption header
26-
// assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`))
27-
// })
20+
it('encrypts payload of query ', async () => {
21+
await lspClient.queryVectorIndex('mock_input')
22+
assert.ok(encryptFunc.calledOnce)
23+
assert.ok(encryptFunc.calledWith(JSON.stringify({ query: 'mock_input' })))
24+
const value = await encryptFunc.returnValues[0]
25+
// verifies JWT encryption header
26+
assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`))
27+
})
2828

29-
// it('encrypts payload of index files ', async () => {
30-
// await lspClient.buildIndex(['fileA'], 'path', 'all')
31-
// assert.ok(encryptFunc.calledOnce)
32-
// assert.ok(
33-
// encryptFunc.calledWith(
34-
// JSON.stringify({
35-
// filePaths: ['fileA'],
36-
// rootPath: 'path',
37-
// refresh: false,
38-
// })
39-
// )
40-
// )
41-
// const value = await encryptFunc.returnValues[0]
42-
// // verifies JWT encryption header
43-
// assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`))
44-
// })
29+
it('encrypts payload of index files ', async () => {
30+
await lspClient.buildIndex(['fileA'], 'path', 'all')
31+
assert.ok(encryptFunc.calledOnce)
32+
assert.ok(
33+
encryptFunc.calledWith(
34+
JSON.stringify({
35+
filePaths: ['fileA'],
36+
rootPath: 'path',
37+
refresh: false,
38+
})
39+
)
40+
)
41+
const value = await encryptFunc.returnValues[0]
42+
// verifies JWT encryption header
43+
assert.ok(value.startsWith(`eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0`))
44+
})
4545

46-
// it('encrypt removes readable information', async () => {
47-
// const sample = 'hello'
48-
// const encryptedSample = await lspClient.encrypt(sample)
49-
// assert.ok(!encryptedSample.includes('hello'))
50-
// })
46+
it('encrypt removes readable information', async () => {
47+
const sample = 'hello'
48+
const encryptedSample = await lspClient.encrypt(sample)
49+
assert.ok(!encryptedSample.includes('hello'))
50+
})
5151

52-
// afterEach(() => {
53-
// sinon.restore()
54-
// })
55-
// })
52+
afterEach(() => {
53+
sinon.restore()
54+
})
55+
})

0 commit comments

Comments
 (0)