From b453c3e4798eb0d17a720b91e633a631cd9eeb70 Mon Sep 17 00:00:00 2001 From: Inga Date: Mon, 15 Jan 2024 20:05:10 +0000 Subject: [PATCH] chore: format all code files according to prettier rules --- src/migrations/1649937605127-Initial.ts | 19 +++++++------- .../transaction.controller.spec.ts | 25 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/migrations/1649937605127-Initial.ts b/src/migrations/1649937605127-Initial.ts index 6353c38..398992d 100644 --- a/src/migrations/1649937605127-Initial.ts +++ b/src/migrations/1649937605127-Initial.ts @@ -1,14 +1,15 @@ -import {MigrationInterface, QueryRunner} from "typeorm"; +import { MigrationInterface, QueryRunner } from 'typeorm'; export class Initial1649937605127 implements MigrationInterface { - name = 'Initial1649937605127' + name = 'Initial1649937605127'; - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`CREATE TABLE \`transaction\` (\`id\` int NOT NULL, \`amount\` int NOT NULL, \`currency\` varchar(255) NOT NULL, \`client_id\` int NOT NULL, \`date\` varchar(255) NOT NULL, \`commission\` int NOT NULL, \`base_currency\` varchar(255) NOT NULL, \`base_amount\` int NOT NULL, PRIMARY KEY (\`id\`))`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP TABLE \`transaction\``); - } + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE \`transaction\` (\`id\` int NOT NULL, \`amount\` int NOT NULL, \`currency\` varchar(255) NOT NULL, \`client_id\` int NOT NULL, \`date\` varchar(255) NOT NULL, \`commission\` int NOT NULL, \`base_currency\` varchar(255) NOT NULL, \`base_amount\` int NOT NULL, PRIMARY KEY (\`id\`))`, + ); + } + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE \`transaction\``); + } } diff --git a/src/transaction/transaction.controller.spec.ts b/src/transaction/transaction.controller.spec.ts index a7e7fba..4c0c389 100644 --- a/src/transaction/transaction.controller.spec.ts +++ b/src/transaction/transaction.controller.spec.ts @@ -16,10 +16,12 @@ describe('TransactionController Unit Tests', () => { const TransactionServiceProvider = { provide: TransactionService, useFactory: () => ({ - insertOne: jest.fn(() => Promise.reject(new Error("DatabaseNotReachable"))), + insertOne: jest.fn(() => + Promise.reject(new Error('DatabaseNotReachable')), + ), findByClientIdWithinActualMonth: jest.fn((clientId) => { if (clientId === 42) { - return [{base_amount: 1500}]; + return [{ base_amount: 1500 }]; } return []; }), @@ -60,10 +62,10 @@ describe('TransactionController Unit Tests', () => { const result = await transactionController.commission(mockTransactionInput); expect(result).to.eql( - JSON.stringify({ - amount: parseFloat('5.00').toFixed(2), - currency: 'EUR', - }), + JSON.stringify({ + amount: parseFloat('5.00').toFixed(2), + currency: 'EUR', + }), ); }); @@ -76,8 +78,8 @@ describe('TransactionController Unit Tests', () => { }; const result = await transactionController.applyRules( - [transactionController.discountRule, transactionController.turnoverRule], - mockTransactionInput, + [transactionController.discountRule, transactionController.turnoverRule], + mockTransactionInput, ); expect(result).to.eql(5); @@ -91,11 +93,8 @@ describe('TransactionController Unit Tests', () => { client_id: 1, }; - const result = await transactionController.commission( - mockTransactionInput, - ); + const result = await transactionController.commission(mockTransactionInput); - expect(result).to.eql("{\"amount\":\"4.17\",\"currency\":\"EUR\"}"); + expect(result).to.eql('{"amount":"4.17","currency":"EUR"}'); }); - });