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,12 +35,12 @@ export default class DIDResolved {
|
|||||||
|
|
||||||
public isURL(): boolean {
|
public isURL(): boolean {
|
||||||
const item = this.getLastItem()
|
const item = this.getLastItem()
|
||||||
return item && item.valueType == "URL"
|
return item && item.valueType === "URL"
|
||||||
}
|
}
|
||||||
|
|
||||||
public isDDO(): boolean {
|
public isDDO(): boolean {
|
||||||
const item = this.getLastItem()
|
const item = this.getLastItem()
|
||||||
return item && item.valueType == "DDO"
|
return item && item.valueType === "DDO"
|
||||||
}
|
}
|
||||||
|
|
||||||
public getValue(): string {
|
public getValue(): string {
|
||||||
|
@ -47,7 +47,7 @@ describe("DIDResolver", () => {
|
|||||||
const didResolved = await didResolver.resolve(did)
|
const didResolved = await didResolver.resolve(did)
|
||||||
assert(didResolved)
|
assert(didResolved)
|
||||||
assert(didResolved.isURL())
|
assert(didResolved.isURL())
|
||||||
assert(didResolved.getValue() == testURL)
|
assert(didResolved.getValue() === testURL)
|
||||||
|
|
||||||
})
|
})
|
||||||
it("should register chain of attributes and resolve", async () => {
|
it("should register chain of attributes and resolve", async () => {
|
||||||
@ -58,21 +58,21 @@ describe("DIDResolver", () => {
|
|||||||
const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider")
|
const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider")
|
||||||
|
|
||||||
for ( let index = 0; index < chainLength; index ++ ) {
|
for ( let index = 0; index < chainLength; index ++ ) {
|
||||||
let did = DIDTools.idToDID(IdGenerator.generateId())
|
const did = DIDTools.idToDID(IdGenerator.generateId())
|
||||||
didList.push(did)
|
didList.push(did)
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( let index = 0; index < chainLength - 1; index ++ ) {
|
for ( let index = 0; index < chainLength - 1; index ++ ) {
|
||||||
let didId = DIDTools.didToId(didList[index])
|
const didId = DIDTools.didToId(didList[index])
|
||||||
let nextDIDId = DIDTools.didToId(didList[index + 1])
|
const nextDIDId = DIDTools.didToId(didList[index + 1])
|
||||||
let receipt = await didRegistry.registerAttribute(didId, ValueType.DID, providerKey,
|
const receipt = await didRegistry.registerAttribute(didId, ValueType.DID, providerKey,
|
||||||
nextDIDId, ownerAccount.getId())
|
nextDIDId, ownerAccount.getId())
|
||||||
assert(receipt)
|
assert(receipt)
|
||||||
}
|
}
|
||||||
const didId = DIDTools.didToId(didList[didList.length - 1])
|
const didIdLast = DIDTools.didToId(didList[didList.length - 1])
|
||||||
const receipt = await didRegistry.registerAttribute(didId, ValueType.URL, providerKey,
|
const receiptLast = await didRegistry.registerAttribute(didIdLast, ValueType.URL, providerKey,
|
||||||
testURL, ownerAccount.getId())
|
testURL, ownerAccount.getId())
|
||||||
assert(receipt)
|
assert(receiptLast)
|
||||||
|
|
||||||
const didResolver = new DIDResolver(didRegistry)
|
const didResolver = new DIDResolver(didRegistry)
|
||||||
assert(didResolver)
|
assert(didResolver)
|
||||||
@ -81,7 +81,7 @@ describe("DIDResolver", () => {
|
|||||||
const didResolved = await didResolver.resolve(didList[0])
|
const didResolved = await didResolver.resolve(didList[0])
|
||||||
assert(didResolved)
|
assert(didResolved)
|
||||||
assert(didResolved.isURL())
|
assert(didResolved.isURL())
|
||||||
assert(didResolved.getValue() == testURL)
|
assert(didResolved.getValue() === testURL)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user