merge of PR-2465: setup unit tests for federation

This commit is contained in:
Claus-Peter Hübner 2022-12-16 01:31:58 +01:00
parent 8bf95ad0ee
commit 814bb996db
5 changed files with 21 additions and 2 deletions

View File

@ -10,7 +10,7 @@ Decimal.set({
})
const constants = {
DB_VERSION: '0055-consistent_deleted_users',
DB_VERSION: '0056-add_communities_table',
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
LOG4JS_CONFIG: 'log4js-config.json',
// default log level on production should be info

View File

@ -155,6 +155,25 @@ describe('federation', () => {
expect(true).toBe(true)
})
})
describe('on data with receiving simply a string', () => {
beforeEach(() => {
socketEventMocks.data(
Buffer.from(
`hello here is a new community and i don't know how to communicate with you`,
),
)
})
it('logged the received data', () => {
expect(logger.info).toBeCalledWith(
`data: hello here is a new community and i don't know how to communicate with you`,
)
})
it('logged a warning of unexpected data format and structure', () => {
expect(logger.warn).toBeCalledWith(
`received totaly wrong or too much apiVersions-Definition JSON-String:hello here is a new community and i don't know how to communicate with you`,
)
})
})
})
})
})

View File

@ -1 +1 @@
export { Community } from './0055-add_communities_table/Community'
export { Community } from './0056-add_communities_table/Community'