Skip to content

Commit

Permalink
ensure it's turned off
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-zhangg committed Nov 29, 2024
1 parent f42f191 commit eb4e7dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ChildProcess } from '../../../shared/utilities/processUtils'
import { assertTelemetryCurried } from '../../testUtil'
import { HttpResourceFetcher } from '../../../shared/resourcefetcher/httpResourceFetcher'
import { SamCliInfoInvocation } from '../../../shared/sam/cli/samCliInfo'
import { CodeScansState } from '../../../codewhisperer'

interface TestScenario {
toolID: AwsClis
Expand Down Expand Up @@ -81,6 +82,12 @@ const scenarios: TestScenario[] = [
]

describe('AppBuilder Walkthrough', function () {
before(async function () {
// ensure auto scan is disabled before testrun
await CodeScansState.instance.setScansEnabled(false)
assert.strictEqual(CodeScansState.instance.isScansEnabled(), false)
})

describe('Reopen template after reload', function () {
let sandbox: sinon.SinonSandbox
let spyExecuteCommand: sinon.SinonSpy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ describe('CodeWhisperer-basicCommands', function () {
sinon.restore()
})

after(async function () {
// disable auto scan after testrun
await CodeScansState.instance.setScansEnabled(false)
assert.strictEqual(CodeScansState.instance.isScansEnabled(), false)
})

describe('toggleCodeSuggestion', function () {
class TestCodeSuggestionsState extends CodeSuggestionsState {
public constructor(initialState?: boolean) {
Expand All @@ -88,12 +94,6 @@ describe('CodeWhisperer-basicCommands', function () {
codeSuggestionsState = new TestCodeSuggestionsState()
})

after(async function () {
// disable auto scan after testrun
await CodeScansState.instance.setScansEnabled(false)
assert.strictEqual(CodeScansState.instance.isScansEnabled(), false)
})

it('has suggestions enabled by default', async function () {
targetCommand = testCommand(toggleCodeSuggestions, codeSuggestionsState)
assert.strictEqual(codeSuggestionsState.isSuggestionsEnabled(), true)
Expand Down

0 comments on commit eb4e7dc

Please sign in to comment.