Skip to content

Commit

Permalink
chore: rebas eme
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Jun 6, 2024
1 parent 3e80498 commit 37e3796
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
11 changes: 8 additions & 3 deletions packages/common/__tests__/utils/alerting.utils.mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export const mockedAddAlert = jest.fn();
export default jest.mock('@src/utils/alerting.utils', () => ({
addAlert: mockedAddAlert.mockReturnValue(Promise.resolve()),
}));
export default jest.mock('@src/utils/alerting.utils', () => {
const originalModule = jest.requireActual('@src/utils/alerting.utils');

return {
...originalModule,
addAlert: mockedAddAlert.mockReturnValue(Promise.resolve()),
};
});
11 changes: 10 additions & 1 deletion packages/common/__tests__/utils/nft.utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-ignore: Using old wallet-lib version, no types exported
import hathorLib from '@hathor/wallet-lib';
import { mockedAddAlert } from './alerting.utils.mock';
import { Severity } from '@src/types';
import { NftUtils } from '@src/utils/nft.utils';
import { Severity } from '@src/types';
import { getHandlerContext, getTransaction } from '../events/nftCreationTx';
import {
LambdaClient as LambdaClientMock,
Expand Down Expand Up @@ -37,6 +37,15 @@ jest.mock('@aws-sdk/client-lambda', () => {
};
});

jest.mock('@src/utils/index.utils', () => {
const originalModule = jest.requireActual('@src/utils/index.utils');

return {
...originalModule,
assertEnvVariablesExistence: jest.fn(),
};
});

const network = new hathorLib.Network('testnet');
const logger = new Logger();

Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/utils/alerting.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
import { SendMessageCommand, SQSClient } from '@aws-sdk/client-sqs';
import { Severity } from '../types';
import { Logger } from 'winston';
import * as indexUtils from './index.utils';
import { assertEnvVariablesExistence } from './index.utils';

console.log('index utils: ', indexUtils);

assertEnvVariablesExistence([
'NETWORK',
'APPLICATION_NAME',
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/utils/index.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/

export * as alertUtils from './alerting.utils';
export * as nftUtils from './nft.utils';
export * as walletUtils from './wallet.utils';
export * from './alerting.utils';
export * from './nft.utils';
export * from './wallet.utils';

/**
* Validates if a list of env variables are set in the environment. Throw if at least
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"test_images_wait_for_db": "yarn dlx ts-node ./__tests__/integration/scripts/wait-for-db-up.ts",
"test_images_wait_for_ws": "yarn dlx ts-node ./__tests__/integration/scripts/wait-for-ws-up.ts",
"test_images_setup_database": "yarn dlx ts-node ./__tests__/integration/scripts/setup-database.ts",
"test": "jest --coverage",
"test": "jest --coverage --verbose",
"test_integration": "yarn run test_images_up && yarn run test_images_wait_for_db && yarn run test_images_wait_for_ws && yarn run test_images_setup_database && yarn run test_images_migrate && yarn run test_images_integration && yarn run test_images_down"
},
"name": "sync-daemon",
Expand Down

0 comments on commit 37e3796

Please sign in to comment.