diff --git a/docker-compose.yml b/docker-compose.yml index 4105ef04a..7be98099d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -163,14 +163,14 @@ services: - internal-net - external-net ports: - - 5000:5000 + - 5010:5010 depends_on: - mariadb restart: always environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - - PORT=5000 + - PORT=5010 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT diff --git a/federation/Dockerfile b/federation/Dockerfile index e2d74c817..959252d29 100644 --- a/federation/Dockerfile +++ b/federation/Dockerfile @@ -15,7 +15,8 @@ ENV BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs -ENV PORT="5000" +ENV PORT="5010" +# ENV PORT="${env.FEDERATION_PORT}" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" diff --git a/federation/jest.config.js b/federation/jest.config.js index aa28622fd..742f35fbb 100644 --- a/federation/jest.config.js +++ b/federation/jest.config.js @@ -10,7 +10,7 @@ module.exports = { '!build/**', ], setupFiles: ['/test/testSetup.ts'], - setupFilesAfterEnv: ['/test/extensions.ts'], + setupFilesAfterEnv: [], modulePathIgnorePatterns: ['/build/'], moduleNameMapper: { '@/(.*)': '/src/$1', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 588f52c60..84259f09a 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -24,7 +24,7 @@ const constants = { } const server = { - PORT: process.env.PORT || 5000, + PORT: process.env.PORT || 5010, // JWT_SECRET: process.env.JWT_SECRET || 'secret123', // JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN || '10m', GRAPHIQL: process.env.GRAPHIQL === 'true' || false, @@ -73,7 +73,7 @@ if ( const federation = { // FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null, // FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || null, - FEDERATION_PORT: process.env.FEDERATION_PORT || 5000, + FEDERATION_PORT: process.env.FEDERATION_PORT || 5010, FEDERATION_API: process.env.FEDERATION_API || '1_0', FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null, } diff --git a/federation/test/extensions.ts b/federation/test/extensions.ts deleted file mode 100644 index 69c2ff7a6..000000000 --- a/federation/test/extensions.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ - -import Decimal from 'decimal.js-light' - -expect.extend({ - decimalEqual(received, value) { - const pass = new Decimal(value).equals(received.toString()) - if (pass) { - return { - message: () => `expected ${received} to not equal ${value}`, - pass: true, - } - } else { - return { - message: () => `expected ${received} to equal ${value}`, - pass: false, - } - } - }, -}) - -interface CustomMatchers { - decimalEqual(value: number): R -} - -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace jest { - interface Expect extends CustomMatchers {} - interface Matchers extends CustomMatchers {} - interface InverseAsymmetricMatchers extends CustomMatchers {} - } -} diff --git a/federation/test/helpers.test.ts b/federation/test/helpers.test.ts deleted file mode 100644 index 7e3eced5a..000000000 --- a/federation/test/helpers.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { contributionDateFormatter } from '@test/helpers' - -describe('contributionDateFormatter', () => { - it('formats the date correctly', () => { - expect( - contributionDateFormatter(new Date('Thu Feb 29 2024 13:12:11')) - ).toEqual('2/29/2024') - }) -}) diff --git a/federation/test/helpers.ts b/federation/test/helpers.ts deleted file mode 100644 index 9fb67d585..000000000 --- a/federation/test/helpers.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ - -import { createTestClient } from 'apollo-server-testing' -import createServer from '../src/server/createServer' -import { initialize } from '@dbTools/helpers' -import { entities } from '@entity/index' -import { logger } from './testSetup' - -export const headerPushMock = jest.fn((t) => { - context.token = t.value -}) - -const context = { - token: '', - setHeaders: { - push: headerPushMock, - forEach: jest.fn(), - }, - clientTimezoneOffset: 0, -} - -export const cleanDB = async () => { - // this only works as lond we do not have foreign key constraints - for (let i = 0; i < entities.length; i++) { - await resetEntity(entities[i]) - } -} - -export const testEnvironment = async (testLogger: any = logger) => { - const server = await createServer(testLogger) - const con = server.con - const testClient = createTestClient(server.apollo) - const mutate = testClient.mutate - const query = testClient.query - await initialize() - return { mutate, query, con } -} - -export const resetEntity = async (entity: any) => { - const items = await entity.find({ withDeleted: true }) - if (items.length > 0) { - const ids = items.map((i: any) => i.id) - await entity.delete(ids) - } -} - -export const resetToken = () => { - context.token = '' -} - -// format date string as it comes from the frontend for the contribution date -export const contributionDateFormatter = (date: Date): string => { - return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}` -} - -export const setClientTimezoneOffset = (offset: number): void => { - context.clientTimezoneOffset = offset -}