mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
add updateDDO() unit test
This commit is contained in:
parent
ac76380ba9
commit
10558f9c96
@ -157,4 +157,38 @@ describe('Aquarius', () => {
|
||||
assert(restrieveResult.id === storageResult.id)
|
||||
})
|
||||
})
|
||||
|
||||
describe('#updateDDO()', () => {
|
||||
const did: DID = DID.generate()
|
||||
const ddo: DDO = new DDO({
|
||||
id: did.getId(),
|
||||
publicKey: [
|
||||
{
|
||||
id: 'hello',
|
||||
type: 'Ed25519VerificationKey2018',
|
||||
owner: '0xOwner'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
it('should store a ddo', async () => {
|
||||
spy.on(aquarius.fetch, 'post', () => reponsify(ddo))
|
||||
const result: DDO = await aquarius.storeDDO(ddo)
|
||||
assert(result)
|
||||
assert(result.id === ddo.id)
|
||||
})
|
||||
|
||||
it('should update a ddo', async () => {
|
||||
const newOwner = '0xhello'
|
||||
const newDdo = ddo
|
||||
newDdo.publicKey[0].owner = newOwner
|
||||
|
||||
spy.on(aquarius.fetch, 'put', () => reponsify(newDdo))
|
||||
|
||||
const updateResult: DDO = await aquarius.updateDDO(did, newDdo)
|
||||
assert(updateResult)
|
||||
assert(updateResult.id === ddo.id)
|
||||
assert(updateResult.publicKey[0].owner === newOwner)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user