diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 806ae6bda..9a8c223f1 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -698,6 +698,9 @@ describe('UserResolver', () => { }) describe('no users in database', () => { + beforeAll(() => { + clearLogs() + }) it('throws an error', async () => { jest.clearAllMocks() const result = await mutate({ mutation: login, variables }) @@ -709,6 +712,7 @@ describe('UserResolver', () => { }) it('logs the error found', () => { + printLogs() expect(logger.warn).toBeCalledWith( `findUserByEmail failed, user with email=${variables.email} not found`, ) diff --git a/dht-node/src/dht_node/index.test.ts b/dht-node/src/dht_node/index.test.ts index 9953bee9b..20cc52057 100644 --- a/dht-node/src/dht_node/index.test.ts +++ b/dht-node/src/dht_node/index.test.ts @@ -3,7 +3,7 @@ import { Community as DbCommunity, FederatedCommunity as DbFederatedCommunity } import { validate as validateUUID, version as versionUUID } from 'uuid' import { cleanDB, testEnvironment } from '@test/helpers' -import { cleanLogs, getLogger, printLogs } from 'config-schema/test/testSetup' +import { clearLogs, getLogger, printLogs } from 'config-schema/test/testSetup' import { CONFIG } from '@/config' @@ -358,6 +358,7 @@ describe('federation', () => { let jsonArray: any[] let result: DbFederatedCommunity[] = [] beforeAll(async () => { + clearLogs() jest.clearAllMocks() jsonArray = [ { @@ -373,6 +374,7 @@ describe('federation', () => { ] await socketEventMocks.data(Buffer.from(JSON.stringify(jsonArray))) result = await DbFederatedCommunity.find({ where: { foreign: true } }) + printLogs() }) afterAll(async () => { diff --git a/dht-node/src/dht_node/index.ts b/dht-node/src/dht_node/index.ts index 394c5d86c..dc45b15ed 100644 --- a/dht-node/src/dht_node/index.ts +++ b/dht-node/src/dht_node/index.ts @@ -60,7 +60,6 @@ export const startDHT = async (topic: string): Promise => { server.on('connection', function (socket: any) { logger.info(`server on... with Remote public key: ${socket.remotePublicKey.toString('hex')}`) - socket.on('data', async (data: Buffer) => { try { if (data.length > 1141) { @@ -110,10 +109,9 @@ export const startDHT = async (topic: string): Promise => { const variables = { apiVersion: recApiVersion.api, endPoint: recApiVersion.url, - publicKey: socket.remotePublicKey.toString('hex'), + publicKey: socket.remotePublicKey, lastAnnouncedAt: new Date(), } - logger.debug(`upsert with variables=${JSON.stringify(variables, null, 2)}`) // this will NOT update the updatedAt column, to distingue between a normal update and the last announcement await DbFederatedCommunity.createQueryBuilder() .insert()