Skip to content

Commit

Permalink
test(NODE-5992): fix env var restoration in tests (#4017)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenakhineika authored Mar 5, 2024
1 parent eab8f23 commit 443835e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/integration/auth/mongodb_aws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ describe('MONGODB-AWS', function () {
});

describe('with missing aws token', () => {
let awsSessionToken;
let awsSessionToken: string | undefined;

beforeEach(function () {
beforeEach(() => {
awsSessionToken = process.env.AWS_SESSION_TOKEN;
delete process.env.AWS_SESSION_TOKEN;
});

afterEach(async () => {
process.env.AWS_SESSION_TOKEN = awsSessionToken;
afterEach(() => {
if (awsSessionToken != null) {
process.env.AWS_SESSION_TOKEN = awsSessionToken;
}
});

it('should not throw an exception when aws token is missing', async function () {
Expand Down

0 comments on commit 443835e

Please sign in to comment.