-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5efd82c
commit 8b92d1c
Showing
4 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
packages/daf-resolver-universal/src/__tests__/default.test.ts
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
packages/daf-resolver-universal/src/__tests__/resolver.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { DafUniversalResolver } from '../resolver' | ||
import fetchMock from 'jest-fetch-mock' | ||
fetchMock.enableMocks() | ||
|
||
describe('daf-resolver-universal', () => { | ||
it('should throw error when misconfigured', () => { | ||
expect(() => { | ||
//@ts-ignore | ||
new DafUniversalResolver({}) | ||
}).toThrow() | ||
}) | ||
|
||
it('should have resolve method', () => { | ||
const resolver = new DafUniversalResolver({ url: 'https://example/' }) | ||
expect(resolver).toHaveProperty('resolve') | ||
}) | ||
|
||
it('should fetch did doc', async () => { | ||
const resolver = new DafUniversalResolver({ url: 'https://example/' }) | ||
fetchMock.mockResponse(JSON.stringify({ didDocument: { data: '12345' } })) | ||
const doc = await resolver.resolve('did:example:123') | ||
expect(doc).toEqual({ data: '12345' }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters