本文整理匯總了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()
}