Skip to content

Commit

Permalink
fix: Download lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm committed Dec 6, 2021
1 parent 8266442 commit ba504f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
coverageThreshold: {
global: {
branches: 80,
functions: 60,
functions: 56,
lines: 80,
statements: 80
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe('Test scale up lambda wrapper.', () => {
resolve();
});
});
await expect(handler({}, {})).resolves;
await expect(handler({}, {}, {})).resolves;
});

it('Scale without error should resolve2 . ', async () => {
const mock = mocked(sync);
mock.mockRejectedValue(new Error(''));

await expect(handler({}, {})).resolves;
await expect(handler({}, {}, {})).resolves;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { sync } from './syncer/syncer';
import { logger } from './syncer/logger';

// eslint-disable-next-line
export const handler = async (event: any, context: any): Promise<void> => {
export async function handler(event: any, context: any, callback: any): Promise<void> {
logger.setSettings({ requestId: context.awsRequestId });
logger.debug(JSON.stringify(event));

return new Promise((resolve) => {
sync()
.then(() => resolve())
.catch((e: Error) => {
logger.warn('Ignoring error:', e);
resolve();
});
});
};
try {
await sync();
callback(null);
} catch (e) {
logger.warn('Ignoring error:', e);
callback(e);
}
}

0 comments on commit ba504f8

Please sign in to comment.