本文整理汇总了TypeScript中alsatian.Expect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Expect函数的具体用法?TypeScript Expect怎么用?TypeScript Expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Expect函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: claimToHexFailIfChangedAttribute
@Test()
@TestCase(TheRaven)
public claimToHexFailIfChangedAttribute(work: Work) {
// Changing any field should change the serialized too
Expect(
Serialization.claimToHex(
editAttributes(work, {
name: 'Nevermore',
})
)
).not.toBe(TheRavenHex)
Expect(
Serialization.claimToHex(
editAttributes(work, {
author: 'E.A.P.',
})
)
).not.toBe(TheRavenHex)
Expect(
Serialization.claimToHex(
editAttributes(work, {
dateCreated: new Date().toISOString(),
})
)
).not.toBe(TheRavenHex)
}
示例2: mixerReturnsCorrectLength
@Test()
public mixerReturnsCorrectLength() {
let mixer = new Mixer({secondsPerMix: 1}, {});
let results = mixer.mix(44100);
Expect(results.bufferSize).toBe(44100);
Expect(results.output[0].length).toBe(44100); /* mixing is always in stereo */
Expect(results.output[1].length).toBe(44100); /* mixing is always in stereo */
}
示例3: getWorksByPublicKeyShouldSucceed
@AsyncTest()
@TestCase(TheRaven.publicKey)
@TestCase(TheMurdersInTheRueMorgue.publicKey)
@TestCase(AStudyInScarlet.publicKey)
async getWorksByPublicKeyShouldSucceed(publicKey: string) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
}
示例4: postWorkShouldSucceedWith202
@AsyncTest()
async postWorkShouldSucceedWith202() {
const claim = createClaim(Key1.privateKey, ClaimType.Work, {
name: 'Name',
})
const postResponse = await this.client.postWork(claim)
Expect(postResponse.ok).toBeTruthy()
Expect(postResponse.status).toBe(202)
}
示例5: getWorksByACDPublicKeyShouldReturnOneElement
@AsyncTest()
@TestCase(AStudyInScarlet.publicKey)
async getWorksByACDPublicKeyShouldReturnOneElement(publicKey: string) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const claims = await response.json()
Expect(claims.length).toBe(1)
}
示例6: getWorksByEAPPublicKeyShouldReturnTwoElements
@AsyncTest()
@TestCase(TheRaven.publicKey)
async getWorksByEAPPublicKeyShouldReturnTwoElements(publicKey: string) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const claims = await response.json()
Expect(claims.length).toBe(2)
}
示例7: getWork404
@AsyncTest()
@TestCase('1234')
async getWork404(id: string) {
const response = await this.client.getWork(id)
Expect(response.status).toBe(404)
Expect(response.ok).not.toBeTruthy()
const body = await response.text()
Expect(body).toBe('')
}
示例8: getWork200
@AsyncTest()
@TestCase(TheRaven)
@TestCase(TheMurdersInTheRueMorgue)
@TestCase(AStudyInScarlet)
async getWork200(claim: Claim) {
const response = await this.client.getWork(claim.id)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const body = await response.json()
Expect(body.id).toBe(claim.id)
Expect(body.attributes.name).toBe(claim.attributes.name)
}
示例9: getWorksByPublicKeyShouldReturnClaimsMatchingPublicKey
@AsyncTest()
@TestCase(TheRaven.publicKey)
@TestCase(TheMurdersInTheRueMorgue.publicKey)
@TestCase(AStudyInScarlet.publicKey)
async getWorksByPublicKeyShouldReturnClaimsMatchingPublicKey(publicKey: string) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const claims = await response.json()
const allElementsMatchPublicKey = !claims.find((claim: Claim) => claim.publicKey !== publicKey)
Expect(allElementsMatchPublicKey).toBeTruthy()
}
示例10: getWorksByPublicKeyShouldReturnAnArray
@AsyncTest()
@TestCase(TheRaven.publicKey)
@TestCase(TheMurdersInTheRueMorgue.publicKey)
@TestCase(AStudyInScarlet.publicKey)
async getWorksByPublicKeyShouldReturnAnArray(publicKey: string) {
const response = await this.client.getWorksByPublicKey(publicKey)
Expect(response.status).toBe(200)
Expect(response.ok).toBeTruthy()
const claims = await response.json()
Expect(claims).toBeDefined()
Expect(Array.isArray(claims)).toBeTruthy()
}