Merge pull request 'chore: format all code files according to prettier rules' (#5) from chore-format into main

Reviewed-on: #5
pull/18/head
Inga 🏳‍🌈 10 months ago
commit a228668915
  1. 9
      src/migrations/1649937605127-Initial.ts
  2. 13
      src/transaction/transaction.controller.spec.ts

@ -1,14 +1,15 @@
import {MigrationInterface, QueryRunner} from "typeorm"; import { MigrationInterface, QueryRunner } from 'typeorm';
export class Initial1649937605127 implements MigrationInterface { export class Initial1649937605127 implements MigrationInterface {
name = 'Initial1649937605127' name = 'Initial1649937605127';
public async up(queryRunner: QueryRunner): Promise<void> { public async up(queryRunner: QueryRunner): Promise<void> {
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\`))`); 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<void> { public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE \`transaction\``); await queryRunner.query(`DROP TABLE \`transaction\``);
} }
} }

@ -16,10 +16,12 @@ describe('TransactionController Unit Tests', () => {
const TransactionServiceProvider = { const TransactionServiceProvider = {
provide: TransactionService, provide: TransactionService,
useFactory: () => ({ useFactory: () => ({
insertOne: jest.fn(() => Promise.reject(new Error("DatabaseNotReachable"))), insertOne: jest.fn(() =>
Promise.reject(new Error('DatabaseNotReachable')),
),
findByClientIdWithinActualMonth: jest.fn((clientId) => { findByClientIdWithinActualMonth: jest.fn((clientId) => {
if (clientId === 42) { if (clientId === 42) {
return [{base_amount: 1500}]; return [{ base_amount: 1500 }];
} }
return []; return [];
}), }),
@ -91,11 +93,8 @@ describe('TransactionController Unit Tests', () => {
client_id: 1, client_id: 1,
}; };
const result = await transactionController.commission( const result = await transactionController.commission(mockTransactionInput);
mockTransactionInput,
);
expect(result).to.eql("{\"amount\":\"4.17\",\"currency\":\"EUR\"}"); expect(result).to.eql('{"amount":"4.17","currency":"EUR"}');
}); });
}); });

Loading…
Cancel
Save