Skip to content

Commit 99710eb

Browse files
committed
Better lint
1 parent 31c03a5 commit 99710eb

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

modules/material-management/test/cryptographic_material.test.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,9 @@ describe('decorateCryptographicMaterial', () => {
117117
const test = decorateCryptographicMaterial({ suite } as any)
118118
test.zeroUnencryptedDataKey()
119119
const dataKey = new Uint8Array(suite.keyLengthBytes).fill(1)
120-
const trace =
121-
// It is very hard to test this perfectly. However, this tests the spirit.
122-
expect(() =>
123-
test.setUnencryptedDataKey(new Uint8Array(dataKey), trace)
124-
).to.throw()
120+
121+
// It is very hard to test this perfectly. However, this tests the spirit.
122+
expect(() => test.setUnencryptedDataKey(new Uint8Array(dataKey))).to.throw()
125123
})
126124

127125
it('Precondition: dataKey must be Binary Data', () => {
@@ -138,10 +136,10 @@ describe('decorateCryptographicMaterial', () => {
138136
)
139137
const test = decorateCryptographicMaterial({ suite } as any)
140138
const dataKey = new Uint8Array(suite.keyLengthBytes).fill(1)
141-
const trace = test.setUnencryptedDataKey(new Uint8Array(dataKey), trace)
142-
expect(() =>
143-
test.setUnencryptedDataKey(new Uint8Array(dataKey), trace)
144-
).to.throw('unencryptedDataKey has already been set')
139+
test.setUnencryptedDataKey(new Uint8Array(dataKey))
140+
expect(() => test.setUnencryptedDataKey(new Uint8Array(dataKey))).to.throw(
141+
'unencryptedDataKey has already been set'
142+
)
145143
})
146144

147145
it('Precondition: dataKey should have an ArrayBuffer that *only* stores the key.', () => {
@@ -154,9 +152,9 @@ describe('decorateCryptographicMaterial', () => {
154152
5,
155153
suite.keyLengthBytes
156154
).fill(1)
157-
const trace = expect(() =>
158-
test.setUnencryptedDataKey(dataKey, trace)
159-
).to.throw('Unencrypted Master Key must be an isolated buffer.')
155+
expect(() => test.setUnencryptedDataKey(dataKey)).to.throw(
156+
'Unencrypted Master Key must be an isolated buffer.'
157+
)
160158
})
161159

162160
it('Precondition: The unencryptedDataKey must not have been modified.', () => {
@@ -374,7 +372,7 @@ describe('decorateWebCryptoMaterial', () => {
374372
usages: ['deriveKey'],
375373
extractable: false,
376374
}
377-
const trace = test.setCryptoKey(key, trace)
375+
test.setCryptoKey(key)
378376
expect(test.getCryptoKey() === key).to.equal(true)
379377
expect(test.hasCryptoKey).to.equal(true)
380378
expect(test.hasUnencryptedDataKey).to.equal(false)
@@ -395,7 +393,7 @@ describe('decorateWebCryptoMaterial', () => {
395393
extractable: false,
396394
}
397395
const mixedKey: any = { zeroByteCryptoKey: key, nonZeroByteCryptoKey: key }
398-
const trace = test.setCryptoKey(mixedKey, trace)
396+
test.setCryptoKey(mixedKey)
399397
expect(test.getCryptoKey() !== mixedKey).to.equal(true)
400398
expect(test.hasCryptoKey).to.equal(true)
401399
expect(test.hasUnencryptedDataKey).to.equal(false)
@@ -427,8 +425,8 @@ describe('decorateWebCryptoMaterial', () => {
427425
usages: ['deriveKey'],
428426
extractable: false,
429427
}
430-
const trace = test.setCryptoKey(key, trace)
431-
expect(() => test.setCryptoKey(key, trace)).to.throw()
428+
test.setCryptoKey(key)
429+
expect(() => test.setCryptoKey(key)).to.throw()
432430
})
433431

434432
it('Precondition: The CryptoKey must match the algorithm suite specification.', () => {
@@ -467,15 +465,15 @@ describe('decorateWebCryptoMaterial', () => {
467465
extractable: true,
468466
},
469467
}
470-
const trace = expect(() => test.setCryptoKey(key, trace)).to.throw()
471-
expect(() => test.setCryptoKey(key1, trace)).to.throw()
472-
expect(() => test.setCryptoKey(key2, trace)).to.throw()
468+
expect(() => test.setCryptoKey(key)).to.throw()
469+
expect(() => test.setCryptoKey(key1)).to.throw()
470+
expect(() => test.setCryptoKey(key2)).to.throw()
473471
})
474472

475473
it('Precondition: dataKey must be a supported type.', () => {
476474
const test: any = decorateWebCryptoMaterial({} as any)
477475
const key: any = {}
478-
const trace = expect(() => test.setCryptoKey(key, trace)).to.throw()
476+
expect(() => test.setCryptoKey(key)).to.throw()
479477
})
480478
})
481479

0 commit comments

Comments
 (0)