本文整理汇总了TypeScript中Claim.getClaimId函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getClaimId函数的具体用法?TypeScript getClaimId怎么用?TypeScript getClaimId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getClaimId函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: claimIdShouldNotChangeWithAttributeKeyCasing
@Test()
@TestCase(TheRaven.attributes.name, TheRaven.attributes.author)
@TestCase(TheMurdersInTheRueMorgue.attributes.name, TheMurdersInTheRueMorgue.attributes.author)
@TestCase(AStudyInScarlet.attributes.name, AStudyInScarlet.attributes.author)
public claimIdShouldNotChangeWithAttributeKeyCasing(name: string, author: string) {
const work1: Claim = makeClaim({
name,
author,
})
const work2: Claim = makeClaim({
Author: author,
NAME: name,
})
Expect(getClaimId(work1)).toBe(getClaimId(work2))
}
示例2: claimIdIncludesDate
@Test()
@TestCase(TheRaven)
public claimIdIncludesDate(work: Work) {
Expect(
getClaimId({
...work,
dateCreated: new Date(),
})
).not.toBe(work.id)
}
示例3: claimIdIncludesType
@Test()
@TestCase(TheRaven)
public claimIdIncludesType(work: Work) {
Expect(
getClaimId({
...work,
type: 'Asd' as ClaimType,
})
).not.toBe(work.id)
}
示例4: claimIdIncludesPublicKey
@Test()
@TestCase(TheRaven)
public claimIdIncludesPublicKey(work: Work) {
Expect(
getClaimId({
...work,
publicKey: '123',
})
).not.toBe(work.id)
}
示例5: claimIdIgnoresSignature
@Test()
@TestCase(TheRaven)
public claimIdIgnoresSignature(work: Work) {
// The field .signature is ignored in the calculation of the id
const ignoreSignature = getClaimId({
...work,
signature: '123',
})
Expect(ignoreSignature).toBe(work.id)
}
示例6: claimIdIgnoresId
@Test()
@TestCase(TheRaven)
public claimIdIgnoresId(work: Work) {
// The field .id is ignored in the calculation of the id
const ignoreId = getClaimId({
...work,
id: '123',
})
Expect(ignoreId).toBe(work.id)
}
示例7: claimId
@Test()
@TestCase(TheRaven)
public claimId(work: Work) {
const claimId = getClaimId(work)
Expect(claimId).toBe(work.id)
}