generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes bugs in web5.dwn.records.write and Record.data (#51)
* Fixes bugs in web5.dwn.records.write and Record.data Signed-off-by: Frank Hinek <[email protected]> * 0.6.1 --------- Signed-off-by: Frank Hinek <[email protected]>
- Loading branch information
1 parent
d5caeaf
commit 8300edf
Showing
19 changed files
with
787 additions
and
301 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,54 @@ | ||
import { expect } from 'chai'; | ||
import sinon from 'sinon'; | ||
|
||
import { Web5Did } from '../../src/did/web5-did.js'; | ||
|
||
describe('DidManager', async () => { | ||
let web5did; | ||
|
||
beforeEach(function () { | ||
web5did = new Web5Did(); | ||
}); | ||
|
||
before(function () { | ||
this.clock = sinon.useFakeTimers(); | ||
}); | ||
|
||
after(function () { | ||
this.clock.restore(); | ||
}); | ||
|
||
it('should never expire managed DIDs', async function () { | ||
let resolved; | ||
const did = 'did:ion:abcd1234'; | ||
const didData = { | ||
connected: true, | ||
endpoint: 'http://localhost:55500', | ||
}; | ||
|
||
await web5did.manager.set(did, didData); | ||
|
||
resolved = await web5did.resolve(did); | ||
expect(resolved).to.not.be.undefined; | ||
expect(resolved).to.equal(didData); | ||
|
||
this.clock.tick(2147483647); // Time travel 23.85 days | ||
|
||
resolved = await web5did.resolve(did); | ||
expect(resolved).to.not.be.undefined; | ||
expect(resolved).to.equal(didData); | ||
}); | ||
|
||
it('should return object with keys undefined if key data not provided', async () => { | ||
const did = 'did:ion:abcd1234'; | ||
const didData = { | ||
connected: true, | ||
endpoint: 'http://localhost:55500', | ||
}; | ||
|
||
await web5did.manager.set(did, didData); | ||
|
||
const resolved = await web5did.resolve(did); | ||
expect(resolved.keys).to.be.undefined; | ||
}); | ||
}); |
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
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
Oops, something went wrong.