mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
cleanup
This commit is contained in:
parent
ec955060a2
commit
273cb7694a
@ -35,14 +35,14 @@ export default class DIDResolved {
|
||||
|
||||
public isURL(): boolean {
|
||||
const item = this.getLastItem()
|
||||
return item && item.valueType == "URL"
|
||||
return item && item.valueType === "URL"
|
||||
}
|
||||
|
||||
|
||||
public isDDO(): boolean {
|
||||
const item = this.getLastItem()
|
||||
return item && item.valueType == "DDO"
|
||||
return item && item.valueType === "DDO"
|
||||
}
|
||||
|
||||
|
||||
public getValue(): string {
|
||||
const item = this.getLastItem()
|
||||
let result: string = null
|
||||
|
@ -43,11 +43,11 @@ describe("DIDResolver", () => {
|
||||
|
||||
const didResolver = new DIDResolver(didRegistry)
|
||||
assert(didResolver)
|
||||
|
||||
|
||||
const didResolved = await didResolver.resolve(did)
|
||||
assert(didResolved)
|
||||
assert(didResolved.isURL())
|
||||
assert(didResolved.getValue() == testURL)
|
||||
assert(didResolved.getValue() === testURL)
|
||||
|
||||
})
|
||||
it("should register chain of attributes and resolve", async () => {
|
||||
@ -58,30 +58,30 @@ describe("DIDResolver", () => {
|
||||
const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider")
|
||||
|
||||
for ( let index = 0; index < chainLength; index ++ ) {
|
||||
let did = DIDTools.idToDID(IdGenerator.generateId())
|
||||
const did = DIDTools.idToDID(IdGenerator.generateId())
|
||||
didList.push(did)
|
||||
}
|
||||
|
||||
|
||||
for ( let index = 0; index < chainLength - 1; index ++ ) {
|
||||
let didId = DIDTools.didToId(didList[index])
|
||||
let nextDIDId = DIDTools.didToId(didList[index + 1])
|
||||
let receipt = await didRegistry.registerAttribute(didId, ValueType.DID, providerKey,
|
||||
const didId = DIDTools.didToId(didList[index])
|
||||
const nextDIDId = DIDTools.didToId(didList[index + 1])
|
||||
const receipt = await didRegistry.registerAttribute(didId, ValueType.DID, providerKey,
|
||||
nextDIDId, ownerAccount.getId())
|
||||
assert(receipt)
|
||||
}
|
||||
const didId = DIDTools.didToId(didList[didList.length - 1])
|
||||
const receipt = await didRegistry.registerAttribute(didId, ValueType.URL, providerKey,
|
||||
const didIdLast = DIDTools.didToId(didList[didList.length - 1])
|
||||
const receiptLast = await didRegistry.registerAttribute(didIdLast, ValueType.URL, providerKey,
|
||||
testURL, ownerAccount.getId())
|
||||
assert(receipt)
|
||||
|
||||
assert(receiptLast)
|
||||
|
||||
const didResolver = new DIDResolver(didRegistry)
|
||||
assert(didResolver)
|
||||
|
||||
|
||||
// resolve from the first DID in the chain
|
||||
const didResolved = await didResolver.resolve(didList[0])
|
||||
assert(didResolved)
|
||||
assert(didResolved.isURL())
|
||||
assert(didResolved.getValue() == testURL)
|
||||
assert(didResolved.getValue() === testURL)
|
||||
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user