Skip to content

Commit

Permalink
refactor: return sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
alenakhineika committed Jun 25, 2024
1 parent c9785c8 commit b9dd201
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/suite/oidc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as vscode from 'vscode';
import { createHash } from 'crypto';
import { before, after, afterEach, beforeEach } from 'mocha';
import EventEmitter, { once } from 'events';
import util from 'util';
import { ExtensionContextStub } from './stubs';
import { StorageController } from '../../storage';
import { TelemetryService } from '../../telemetry';
Expand All @@ -24,6 +25,10 @@ import { ConnectionString } from 'mongodb-connection-string-url';
import launchMongoShell from '../../commands/launchMongoShell';
import { getFullRange } from './suggestTestHelpers';

const sleep = (ms: number): Promise<void> => {
return util.promisify(setTimeout)(ms);
};

chai.use(chaiAsPromised);

function hash(input: string): string {
Expand Down Expand Up @@ -400,6 +405,7 @@ suite('OIDC Tests', function () {
}

await reAuthPromise;
await sleep(100);

// Because we declined the auth in showInformationMessage above
expect(tokenFetchCalls).to.equal(1);
Expand Down

0 comments on commit b9dd201

Please sign in to comment.