import { DecryptionFixture } from '@aws-crypto/integration-vectors' ; import { buildClient , CommitmentPolicy } from '@aws-crypto/client-browser' ; import { decryptionIntegrationBrowserTest } from './testDecryptFixture' ; const { decrypt } = buildClient ( CommitmentPolicy . FORBID_ENCRYPT_ALLOW_DECRYPT ) ; declare const expect ; declare const __fixtures__ ; declare const fetch ; const tests = __fixtures__ [ 'fixtures/decrypt_tests' ] ; const chunk = __fixtures__ [ 'fixtures/concurrency' ] || 1 ; for ( let i = 0 , j = tests . length ; i < j ; i += chunk ) { decryptionIntegrationBrowserGroup ( chunk , tests . slice ( i , i + chunk ) ) ; } async function loadATest ( testName ) { const response = await fetch ( `base/fixtures/${ testName }.json` ) ; const decryptionFixture = await response . json ( ) ; return decryptionFixture ; } function decryptionIntegrationBrowserGroup ( groupNumber , tests ) { describe ( `browser decryption vectors: ${ groupNumber }` , ( ) => { for ( const testName of tests ) { itDecryptionIntegrationBrowserTest ( testName ) ; } } ) ; } function itDecryptionIntegrationBrowserTest ( testName ) { it ( testName , async ( ) => decryptionIntegrationBrowserTest ( await loadATest ( testName ) , decrypt , expect ) ) ; }