Skip to content

Commit

Permalink
some refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
neo-Lucas-Johannson committed Dec 31, 2024
1 parent a20ef08 commit c51c676
Showing 1 changed file with 18 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ import ms from 'ms';

vi.mock('@aws-sdk/client-secrets-manager');

describe('AWSSecretsManagerPlugin', () => {
const mockSecretValue = JSON.stringify({ testKey: 'testValue' });
const mockSecretValue = JSON.stringify({ testKey: 'testValue' });

const mockSecretsManagerClient = {
send: vi.fn().mockResolvedValue({ SecretString: mockSecretValue }),
};
const mockSecretsManagerClient = {
send: vi.fn().mockResolvedValue({ SecretString: mockSecretValue }),
};

const testPluginOptions = {
secrets: [
{
name: 'testSecret',
region: 'us-east-1',
},
],
};
const testPluginOptions = {
secrets: [
{
name: 'testSecret',
region: 'us-east-1',
},
],
};

let plugin: AWSSecretsManagerPlugin;
let plugin: AWSSecretsManagerPlugin;

beforeEach(() => {
(SecretsManagerClient as jest.Mock).mockImplementation(() => mockSecretsManagerClient);
plugin = new AWSSecretsManagerPlugin(testPluginOptions);
});
beforeEach(() => {
(SecretsManagerClient as jest.Mock).mockImplementation(() => mockSecretsManagerClient);
plugin = new AWSSecretsManagerPlugin(testPluginOptions);
});

describe('AWSSecretsManagerPlugin', () => {
describe('initialize', () => {
it('should initialize the plugin', async () => {
await plugin.initialize({});
Expand Down Expand Up @@ -95,15 +95,6 @@ describe('ConfigDug with AWSSecretsManagerPlugin', () => {
},
};

const testPluginOptions = {
secrets: [
{
name: 'testSecret',
region: 'us-east-1',
},
],
};

const plugin = new AWSSecretsManagerPlugin(testPluginOptions);
const configDug = new ConfigDug(testConfigSchema, { plugins: [plugin] });

Expand Down

0 comments on commit c51c676

Please sign in to comment.