Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Feb 29, 2024
1 parent c907de3 commit 39cb209
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/targets/__tests__/powershell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ describe('pwsh environment variables', () => {
test('success on environment variables', () => {
deleteTargetOptionsFromEnvironment();
setPwshEnvironmentVariables();
// AwsLambdaTarget needs the environment variables to initialize.
getPwshTarget();
});
});
Expand Down Expand Up @@ -80,23 +79,18 @@ describe('config', () => {
describe('publish', () => {
const mockedSpawnProcess = spawnProcess as jest.Mock;
const spawnOptions = { enableInDryRunMode: true, showStdout: true }
// const getArtifactsForRevision = jest.fn()
// .mockImplementation(() => ['moduleName.zip']).bind(PowerShellTarget)

beforeEach(() => {
setPwshEnvironmentVariables();
jest.clearAllMocks();
});

const noArtifactsForRevision = jest.fn().mockImplementation(function () {
return [];
});

test('error on missing artifact', async () => {
const target = getPwshTarget();
target.getArtifactsForRevision = noArtifactsForRevision.bind(
PowerShellTarget
);
target.getArtifactsForRevision = jest.fn()
.mockImplementation(() => []).bind(PowerShellTarget);

// `publish` should report an error. When it's not dry run, the error is
// thrown; when it's on dry run, the error is logged and `undefined` is
// returned. Thus, both alternatives have been considered.
Expand All @@ -118,11 +112,7 @@ describe('publish', () => {
// thrown; when it's on dry run, the error is logged and `undefined` is
// returned. Thus, both alternatives have been considered.
try {
const multiplePackagesFound = await target.publish(
'version',
'revision'
);
expect(multiplePackagesFound).toBe(undefined);
await target.publish('1.0', 'sha');
} catch (error) {
expect(error).toBeInstanceOf(Error);
expect(error.message).toMatch(/found multiple matching artifacts/);
Expand Down

0 comments on commit 39cb209

Please sign in to comment.