From 9e0b1f72e83bc390330f8d40ff8ab4b3f01558aa Mon Sep 17 00:00:00 2001 From: einhorn_b Date: Thu, 18 Jan 2024 14:36:18 +0100 Subject: [PATCH] fix test --- dht-node/jest.config.js | 5 +++++ dht-node/src/dht_node/index.test.ts | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dht-node/jest.config.js b/dht-node/jest.config.js index 6540cc68f..12543f8e2 100644 --- a/dht-node/jest.config.js +++ b/dht-node/jest.config.js @@ -21,6 +21,11 @@ module.exports = { process.env.NODE_ENV === 'development' ? '/../database/entity/$1' : '/../database/build/entity/$1', + '@logging/(.*)': + // eslint-disable-next-line n/no-process-env + process.env.NODE_ENV === 'development' + ? '/../database/logging/$1' + : '/../database/build/logging/$1', '@dbTools/(.*)': // eslint-disable-next-line n/no-process-env process.env.NODE_ENV === 'development' diff --git a/dht-node/src/dht_node/index.test.ts b/dht-node/src/dht_node/index.test.ts index 4370a2528..fc2ce7d12 100644 --- a/dht-node/src/dht_node/index.test.ts +++ b/dht-node/src/dht_node/index.test.ts @@ -14,6 +14,7 @@ import { CONFIG } from '@/config' import { startDHT } from './index' CONFIG.FEDERATION_DHT_SEED = '64ebcb0e3ad547848fef4197c6e2332f' +CONFIG.FEDERATION_COMMUNITY_APIS = '1_0,1_1,2_0' jest.mock('@hyperswarm/dht') @@ -248,7 +249,7 @@ describe('federation', () => { it('logs an error of unexpected data format and structure', () => { expect(logger.error).toBeCalledWith( 'Error on receiving data from socket:', - new SyntaxError('Unexpected token \'o\', "no-json string" is not valid JSON'), + new SyntaxError('Unexpected token o in JSON at position 1'), ) }) }) @@ -267,7 +268,7 @@ describe('federation', () => { it('logs an error of unexpected data format and structure', () => { expect(logger.error).toBeCalledWith( 'Error on receiving data from socket:', - new SyntaxError('Unexpected token \'i\', "invalid ty"... is not valid JSON'), + new SyntaxError('Unexpected token i in JSON at position 0'), ) }) }) @@ -291,7 +292,7 @@ describe('federation', () => { it('logs an error of unexpected data format and structure', () => { expect(logger.error).toBeCalledWith( 'Error on receiving data from socket:', - new SyntaxError('Unexpected token \'a\', "api,url,in"... is not valid JSON'), + new SyntaxError('Unexpected token a in JSON at position 0'), ) }) })