Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
Cleaning files (#425)
Browse files Browse the repository at this point in the history
* prettier formatted all files

* prettier removed imports
  • Loading branch information
harshasomisetty authored Jul 16, 2023
1 parent 38214a9 commit 3e37c12
Show file tree
Hide file tree
Showing 243 changed files with 1,004 additions and 1,023 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAccountInfo, getPubkeyType } from '../../src/services/helius.service.js';
import { getPubkeyType } from '../../src/services/helius.service.js';

describe('Wallet', () => {
it('should create a wallet', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ describe('Install Query Params Model', () => {
runMissingFieldTests(
parseAndValidateAppInstallQueryParms,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
runInvalidFieldTypeTests(parseAndValidateAppInstallQueryParms, validParams, fields, wrongTypes);
runEmptyFieldTests(
parseAndValidateAppInstallQueryParms,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('unit testing redirect query parameters model', () => {
runMissingFieldTests(
parseAndValidateAppRedirectQueryParams,
validParams,
fields.filter(field => field !== 'hmac')
fields.filter(field => field !== 'hmac'),
);
runInvalidFieldTypeTests(parseAndValidateAppRedirectQueryParams, validParams, fields, wrongTypes);
runEmptyFieldTests(parseAndValidateAppRedirectQueryParams, validParams, fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe('unit testing the transation request response model', () => {
runMissingFieldTests(
parseAndValidateTransactionRequestResponse,
validParams,
fields.filter(field => field !== 'message')
fields.filter(field => field !== 'message'),
);
runInvalidFieldTypeTests(parseAndValidateTransactionRequestResponse, validParams, fields, wrongTypes);
runEmptyFieldTests(
parseAndValidateTransactionRequestResponse,
validParams,
fields.filter(field => field !== 'message')
fields.filter(field => field !== 'message'),
);
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MerchantService } from '../../../../src/services/database/merchant-service.database.service.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import { MerchantService } from '../../../../src/services/database/merchant-service.database.service.js';
import { createMockMerchant } from '../../../../src/utilities/testing-helper/create-mock.utility.js';
describe('Merchant Testing Suite', () => {
let merchantService: MerchantService;
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('Merchant Testing Suite', () => {
const merchant = await merchantService.createMerchant(
'abcd',
'mock-merchant-create.myshopify.com',
'abcd-1234'
'abcd-1234',
);

expect(merchant).toEqual(mockMerchant);
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('Merchant Testing Suite', () => {
await expect(
merchantService.updateMerchant(mockMerchantThatDoesNotExist, {
lastNonce: 'efgh-5678',
})
}),
).rejects.toThrow();
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PaymentRecordService } from '../../../../src/services/database/payment-record-service.database.service.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import { PaymentRecordStatus } from '@prisma/client';
import { prismaMock } from '../../../../prisma-singleton.js';
import { PaymentRecordService } from '../../../../src/services/database/payment-record-service.database.service.js';
import { createMockPaymentRecord } from '../../../../src/utilities/testing-helper/create-mock.utility.js';

describe('Payment Record Testing Suite', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RefundRecordService } from '../../../../src/services/database/refund-record-service.database.service.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import { RefundRecordStatus } from '@prisma/client';
import { prismaMock } from '../../../../prisma-singleton.js';
import { RefundRecordService } from '../../../../src/services/database/refund-record-service.database.service.js';

describe('Refund Record Testing Suite', () => {
let refundRecordService: RefundRecordService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TransactionRecordService } from '../../../../src/services/database/transaction-record-service.database.service.js';
import { TransactionType } from '@prisma/client';
import { prismaMock } from '../../../../prisma-singleton.js';
import { TransactionRecordService } from '../../../../src/services/database/transaction-record-service.database.service.js';

describe('Transaction Record Testing Suite', () => {
let transactionRecordService: TransactionRecordService;
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('Transaction Record Testing Suite', () => {
'1234',
TransactionType.payment,
'abcd',
null
null,
);

expect(transactionRecord).toEqual(mockTransactionRecord);
Expand All @@ -66,7 +66,7 @@ describe('Transaction Record Testing Suite', () => {
'1234',
TransactionType.refund,
null,
'abcd'
'abcd',
);

expect(transactionRecord).toEqual(mockTransactionRecord);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ShopifyMutationAppConfigure } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { prismaMock } from '../../../../prisma-singleton.js';
import { ShopifyMutationAppConfigure } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { retryAppConfigure } from '../../../../src/services/shopify-retry/retry-app-configure.service.js';
import {
createMockMerchant,
createMockPaymentAppConfigureResponse,
createMockPaymentRecord,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { retryAppConfigure } from '../../../../src/services/shopify-retry/retry-app-configure.service.js';

describe('Shopify Retry App Configure Testing Suite', () => {
it('should execute successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ShopifyMutationPaymentReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { prismaMock } from '../../../../prisma-singleton.js';
import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';
import { ShopifyMutationPaymentReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { retryPaymentReject } from '../../../../src/services/shopify-retry/retry-payment-reject.service.js';
import {
createMockMerchant,
createMockPaymentRecord,
createMockSuccessPaymentSessionRejectResponse,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { retryPaymentReject } from '../../../../src/services/shopify-retry/retry-payment-reject.service.js';
import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';

describe('Shopify Retry Payment Reject Testing Suite', () => {
it('should execute successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ShopifyMutationPaymentResolve } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { prismaMock } from '../../../../prisma-singleton.js';
import { ShopifyMutationPaymentResolve } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { retryPaymentResolve } from '../../../../src/services/shopify-retry/retry-payment-resolve.service.js';
import {
createMockMerchant,
createMockPaymentRecord,
createMockSuccessPaymentSessionResolveResponse,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { retryPaymentResolve } from '../../../../src/services/shopify-retry/retry-payment-resolve.service.js';

describe('Shopify Retry Payment Resolve Testing Suite', () => {
it('should execute successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { prismaMock } from '../../../../prisma-singleton.js';
import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';
import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { retryRefundReject } from '../../../../src/services/shopify-retry/retry-refund-reject.service.js';
import {
createMockMerchant,
createMockRefundRecord,
createMockSuccessRefundSessionRejectResponse,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { retryRefundReject } from '../../../../src/services/shopify-retry/retry-refund-reject.service.js';
import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';

describe('Shopify Retry Refund Reject Testing Suite', () => {
it('should execute successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {
ShopifyMutationRefundReject,
ShopifyMutationRefundResolve,
} from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { prismaMock } from '../../../../prisma-singleton.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { prismaMock } from '../../../../prisma-singleton.js';
import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';
import { ShopifyMutationRefundReject } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { retryRefundResolve } from '../../../../src/services/shopify-retry/retry-refund-resolve.service.js';
import {
createMockMerchant,
createMockPaymentRecord,
createMockRefundRecord,
createMockSuccessPaymentSessionResolveResponse,
createMockSuccessRefundSessionResolveResponse,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { retryRefundResolve } from '../../../../src/services/shopify-retry/retry-refund-resolve.service.js';
import { RefundSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';

describe('Shopify Retry Refund Resolve Testing Suite', () => {
it('should execute successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('unit testing payment app configure', () => {
const mockPaymentAppConfigure = makePaymentAppConfigure(axios);

await expect(
mockPaymentAppConfigure('mock-external-id', true, 'mock-shop', 'mock-token')
mockPaymentAppConfigure('mock-external-id', true, 'mock-shop', 'mock-token'),
).resolves.not.toThrow();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('unit testing payment session resolve', () => {
const mockPaymentSessionResolve = makePaymentSessionResolve(axios);

await expect(
mockPaymentSessionResolve('mock-id', 'mock-shop.shopify.com', 'mock-token')
mockPaymentSessionResolve('mock-id', 'mock-shop.shopify.com', 'mock-token'),
).resolves.not.toThrow();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';
import { makePaymentSessionReject } from '../../../../src/services/shopify/payment-session-reject.service.js';
import { createMockSuccessPaymentSessionRejectResponse } from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { PaymentSessionStateRejectedReason } from '../../../../src/models/shopify-graphql-responses/shared.model.js';

describe('unit testing payment session reject', () => {
it('valid response', async () => {
Expand All @@ -12,7 +12,7 @@ describe('unit testing payment session reject', () => {
const mockPaymentSessionReject = makePaymentSessionReject(axios);

await expect(
mockPaymentSessionReject('mock-id', PaymentSessionStateRejectedReason.risky, 'mock-shop', 'mock-token')
mockPaymentSessionReject('mock-id', PaymentSessionStateRejectedReason.risky, 'mock-shop', 'mock-token'),
).resolves.not.toThrow();
});

Expand Down Expand Up @@ -45,8 +45,8 @@ describe('unit testing payment session reject', () => {
'mock-id',
PaymentSessionStateRejectedReason.processingError,
'mock-shop',
'mock-token'
)
'mock-token',
),
).rejects.toThrow();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('unit testing refund session reject', () => {
const mockRefundSessionReject = makeRefundSessionReject(axios);

await expect(
mockRefundSessionReject('mock-id', 'REJECTED', 'mock-message', 'mock-shop', 'mock-token')
mockRefundSessionReject('mock-id', 'REJECTED', 'mock-message', 'mock-shop', 'mock-token'),
).resolves.not.toThrow();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File: sqsRetryService.test.ts
import { sendRetryMessage } from '../../../../src/services/sqs/sqs-send-message.service.js';
import { SQS } from 'aws-sdk';
import { ShopifyMutationRetryType } from '../../../../src/models/sqs/shopify-mutation-retry.model.js';
import { sendRetryMessage } from '../../../../src/services/sqs/sqs-send-message.service.js';

describe('unit testing the sqs send message service', () => {
it('should call SQS.sendMessage with correct parameters', async () => {
Expand All @@ -27,7 +27,7 @@ describe('unit testing the sqs send message service', () => {
null,
null,
0,
mockSqs
mockSqs,
);

// Validate sendMessage has been called with correct parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { startExecutionOfShopifyMutationRetry } from '../../../../src/services/step-function/start-execution-shopify-retry.service.js';
import { StepFunctions } from 'aws-sdk';
import { startExecutionOfShopifyMutationRetry } from '../../../../src/services/step-function/start-execution-shopify-retry.service.js';

describe('unit testing start execution shopify retry', () => {
it('should execute succesfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as web3 from '@solana/web3.js';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { fetchPaymentTransaction } from '../../../../src/services/transaction-request/fetch-payment-transaction.service.js';
import {
createMockMerchant,
createMockPaymentRecord,
createMockTransactionRequestResponse,
} from '../../../../src/utilities/testing-helper/create-mock.utility.js';
import { fetchPaymentTransaction } from '../../../../src/services/transaction-request/fetch-payment-transaction.service.js';
import MockAdapter from 'axios-mock-adapter';
import axios from 'axios';

describe('fetch payment transaction request testing suite', () => {
it('should fetch a payment transaction request', async () => {
Expand Down Expand Up @@ -34,7 +34,7 @@ describe('fetch payment transaction request testing suite', () => {
mockGasKeypair.publicKey.toBase58(),
mockSingleUseKeypair.publicKey.toBase58(),
mockGasKeypair.publicKey.toBase58(),
axios
axios,
);

expect(true).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
verifyTransferInstructionIsCorrect,
verifyTransactionWithRecord,
verifySingleUseInstruction,
} from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js';
import { TOKEN_PROGRAM_ID, createTransferCheckedInstruction } from '@solana/spl-token';
import * as web3 from '@solana/web3.js';
import { USDC_MINT } from '../../../../src/configs/tokens.config.js';
import {
verifySingleUseInstruction,
verifyTransactionWithRecord,
verifyTransferInstructionIsCorrect,
} from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js';
import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js';
import { createMockPaymentRecord } from '../../../../src/utilities/testing-helper/create-mock.utility.js';

Expand All @@ -32,7 +32,7 @@ describe('unit testing validating discovered payment transactions', () => {
transferQuantity,
6,
[],
TOKEN_PROGRAM_ID
TOKEN_PROGRAM_ID,
);
const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction);

Expand Down Expand Up @@ -60,7 +60,7 @@ describe('unit testing validating discovered payment transactions', () => {
transferQuantity,
6,
[],
TOKEN_PROGRAM_ID
TOKEN_PROGRAM_ID,
);
const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction);

Expand Down Expand Up @@ -89,7 +89,7 @@ describe('unit testing validating discovered payment transactions', () => {
transferQuantity,
6,
[],
TOKEN_PROGRAM_ID
TOKEN_PROGRAM_ID,
);
const mockTransaction = new web3.Transaction().add(transferCheckedInstruction).add(transferCheckedInstruction);

Expand Down Expand Up @@ -136,7 +136,7 @@ describe('unit testing validating discovered payment transactions', () => {
transferQuantity,
6,
[],
TOKEN_PROGRAM_ID
TOKEN_PROGRAM_ID,
);
const ix = web3.SystemProgram.createAccount({
fromPubkey: aliceKeypair.publicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { RefundRecord, RefundRecordStatus } from '@prisma/client';
import { TOKEN_PROGRAM_ID, createTransferCheckedInstruction } from '@solana/spl-token';
import * as web3 from '@solana/web3.js';
import { USDC_MINT } from '../../../../src/configs/tokens.config.js';
import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js';
import { verifyTransactionWithRecord } from '../../../../src/services/transaction-validation/validate-discovered-payment-transaction.service.js';
import { findAssociatedTokenAddress } from '../../../../src/utilities/pubkeys.utility.js';

describe('unit testing validating discovered payment transactions', () => {
process.env.HISTORICAL_FEE_PAYERS = 'historical';
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('unit testing validating discovered payment transactions', () => {
transferQuantity,
6,
[],
TOKEN_PROGRAM_ID
TOKEN_PROGRAM_ID,
);
const ix = web3.SystemProgram.createAccount({
fromPubkey: aliceKeypair.publicKey,
Expand Down
Loading

1 comment on commit 3e37c12

@vercel
Copy link

@vercel vercel bot commented on 3e37c12 Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.