forked from DAVFoundation/dav-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Message.test.js.map
1 lines (1 loc) · 5.57 KB
/
Message.test.js.map
1
{"version":3,"sources":["../src/Message.test.ts"],"names":[],"mappings":";;AAAA,qCAA8B;AAC9B,kEAA2D;AAE3D,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,MAAM,aAAa,GAAG,IAAI,gBAAM,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,cAAc,GAAG,IAAI,uBAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC;IAExB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;QAE1C,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;YAChE,MAAM,SAAS,GAAG;gBAChB,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;aACxC,CAAC;YACF,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YACvD,yCAAyC;YACzC,MAAM,OAAO,GAAG,CAAC,2CAAa,WAAW,EAAC,CAAC,CAAC,OAAO,CAAC;YACpD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;YACnE,MAAM,MAAM,CACV,OAAO,CAAC,OAAO,CAAC,IAAI,uBAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CACzD,CAAC,QAAQ,CAAC,WAAW,EAAE,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AO,CAAC,aAAa,CAAC,CAAC;YACrC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAC/C,QAAQ,EACR,aAAa,EACb,aAAa,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;YACvF,MAAM,SAAS,GAAG;gBAChB,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aACrD,CAAC;YACF,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YACvD,yCAAyC;YACzC,MAAM,OAAO,GAAG,CAAC,2CAAa,WAAW,EAAC,CAAC,CAAC,OAAO,CAAC;YACpD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;YACnE,MAAM,aAAa,GAAG,IAAI,uBAAa,CAAC,EAAE,CAAC,CAAC;YAC5C,MAAM,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACrC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"Message.test.js","sourcesContent":["import Config from './Config';\nimport MessageParams from './drone-charging/MessageParams';\n\ndescribe('Message class', () => {\n const configuration = new Config({});\n const messageContent = new MessageParams({ senderId: 'peerId' });\n const selfId = 'selfId';\n\n describe('respond method', () => {\n const kafkaError = { msg: 'KAFKA_ERROR' };\n\n beforeEach(() => {\n jest.resetAllMocks();\n jest.resetModules();\n });\n\n it('should succeed, validate kafka mock send message', async () => {\n const kafkaMock = {\n sendParams: () => Promise.resolve(true),\n };\n jest.doMock('./Kafka', () => ({ default: kafkaMock }));\n // tslint:disable-next-line:variable-name\n const Message = (await import('./Message')).default;\n const message = new Message(selfId, messageContent, configuration);\n await expect(\n message.respond(new MessageParams({ senderId: selfId })),\n ).resolves.toBeDefined();\n });\n\n it('should fail due to kafka exception', async () => {\n const kafkaMock = {\n sendParams: () => Promise.reject(kafkaError),\n };\n jest.doMock('./Kafka', () => ({ default: kafkaMock }));\n // tslint:disable-next-line:variable-name\n const Message = (await import('./Message')).default;\n const message = new Message(selfId, messageContent, configuration);\n await expect(\n message.respond(new MessageParams({ senderId: selfId })),\n ).rejects.toBe(kafkaError);\n });\n\n it('should call to Kafka sendParams', async () => {\n const kafkaMock = {\n sendParams: jest.fn(() => Promise.resolve(true)),\n };\n jest.doMock('./Kafka', () => ({ default: kafkaMock }));\n // tslint:disable-next-line:variable-name\n const Message = (await import('./Message')).default;\n const message = new Message(selfId, messageContent, configuration);\n const messageParams = new MessageParams({});\n await message.respond(messageParams);\n expect(kafkaMock.sendParams).toHaveBeenCalledWith(\n 'peerId',\n messageParams,\n configuration,\n );\n });\n\n it('should call to Kafka sendParams with message params that contain selfId', async () => {\n const kafkaMock = {\n sendParams: jest.fn(params => Promise.resolve(true)),\n };\n jest.doMock('./Kafka', () => ({ default: kafkaMock }));\n // tslint:disable-next-line:variable-name\n const Message = (await import('./Message')).default;\n const message = new Message(selfId, messageContent, configuration);\n const messageParams = new MessageParams({});\n await message.respond(messageParams);\n expect(kafkaMock.sendParams.mock.calls[0][1].senderId).toBe(selfId);\n });\n });\n});\n"]}