Skip to content

Commit

Permalink
fix: Test daf-url
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored and mirceanis committed Sep 7, 2020
1 parent cd2052f commit 12e2c1e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/daf-url/src/__tests__/message-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@ fetchMock.enableMocks()
describe('daf-url', () => {
const messageHandler = new UrlMessageHandler()

const agent = new Agent({
identityProviders: [],
serviceControllers: [],
didResolver: { resolve: jest.fn() },
messageHandler,
})

it('should reject unknown message type', async () => {
const message = new Message({ raw: 'test', metaData: [{ type: 'test' }] })
expect(messageHandler.handle(message, agent)).rejects.toEqual('Unsupported message type')
expect(messageHandler.handle(message, null)).rejects.toEqual('Unsupported message type')
})

it('should transform message after standard URL', async () => {
Expand All @@ -29,7 +22,7 @@ describe('daf-url', () => {
},
],
})
expect(messageHandler.handle(message, agent)).rejects.toEqual('Unsupported message type')
expect(messageHandler.handle(message, null)).rejects.toEqual('Unsupported message type')
expect(message.raw).toEqual(JWT)
})

Expand All @@ -38,7 +31,7 @@ describe('daf-url', () => {
fetchMock.mockResponse('mockbody')
expect.assertions(2)
try {
await messageHandler.handle(message, agent)
await messageHandler.handle(message, null)
} catch (e) {
expect(e).toMatch('Unsupported message type')
}
Expand Down

0 comments on commit 12e2c1e

Please sign in to comment.