Skip to content

Commit

Permalink
chore: test window
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Feb 7, 2024
1 parent ae5f651 commit 1f11b4f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/fileModifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
assertDiagnosticsEqual
} from './utils'

const MAX_WAIT_TIME_FOR_UPDATE = 5000 // ms
const MAX_WAIT_TIME_FOR_INITIAL_DIAGNOSTICS = 10000 // ms
const MAX_WAIT_TIME_FOR_UPDATE = 10000 // ms
const MAX_WAIT_TIME_FOR_INITIAL_DIAGNOSTICS = 15000 // ms

const docUri = getDocUri('test.ts')
const diagnosticss = getExpectedDiagnosticss()
const diagnostics = getExpectedDiagnostics()

async function writeNewRule() {
let vscodeuri = vscode.Uri.file(
Expand Down Expand Up @@ -69,7 +69,7 @@ suite('Should update when files change', () => {
try {
assertDiagnosticsEqual(
vscode.languages.getDiagnostics(docUri),
diagnosticss[0]
diagnostics[0]
)
} catch (e) {
console.warn(
Expand All @@ -86,7 +86,7 @@ suite('Should update when files change', () => {
}
assertDiagnosticsEqual(
vscode.languages.getDiagnostics(docUri),
diagnosticss[0]
diagnostics[0]
)
}
})
Expand All @@ -95,15 +95,15 @@ suite('Should update when files change', () => {
await waitForDiagnosticChange(MAX_WAIT_TIME_FOR_UPDATE)
assertDiagnosticsEqual(
vscode.languages.getDiagnostics(docUri),
diagnosticss[1]
diagnostics[1]
)
})
test('Update on rule deletion', async () => {
deleteNewRule()
await waitForDiagnosticChange(MAX_WAIT_TIME_FOR_UPDATE)
assertDiagnosticsEqual(
vscode.languages.getDiagnostics(docUri),
diagnosticss[2]
diagnostics[2]
)
})
test('Update on ruleDirs change to nonexistent path', async () => {
Expand All @@ -116,7 +116,7 @@ suite('Should update when files change', () => {
await waitForDiagnosticChange(MAX_WAIT_TIME_FOR_UPDATE)
assertDiagnosticsEqual(
vscode.languages.getDiagnostics(docUri),
diagnosticss[0]
diagnostics[0]
)
})
})
Expand All @@ -127,7 +127,7 @@ function toRange(sLine: number, sChar: number, eLine: number, eChar: number) {
return new vscode.Range(start, end)
}

function getExpectedDiagnosticss() {
function getExpectedDiagnostics() {
const full = [
{
message: 'No Math.random',
Expand Down

0 comments on commit 1f11b4f

Please sign in to comment.