Skip to content

Commit

Permalink
fix: plat-5545 fixing unit test by reading new env var
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoMolinaOZ committed Jan 10, 2025
1 parent 7aeb571 commit 28787f7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/kvstore/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { beforeEach } from 'node:test';
import { KeyValueStoreClient, KeyValueStoreCreateParams } from '.';
import { KeyValueStoreActionClient } from './action';
import { KeyValueStoreLocalClient } from './local';
Expand All @@ -10,13 +11,23 @@ class TestClient extends KeyValueStoreClient {
}

describe('KeyValueStoreClient', () => {
const envs = process.env;
beforeEach(() => {
process.env = { ...envs };
});

afterEach(() => {
process.env = envs;
});

describe('create', () => {
test('creates a local client', async () => {
const client = new TestClient({ path: '/tmp/foo' });
expect(client.getImplementation()).toBeInstanceOf(KeyValueStoreLocalClient);
});

test('creates an autotask client', async () => {
process.env.DEFENDER_ENV = 'action';
const credentials = JSON.stringify({
AccessKeyId: 'keyId',
SecretAccessKey: 'accessKey',
Expand Down

0 comments on commit 28787f7

Please sign in to comment.