Kill crypto subprocess so tests actually finish running

This commit is contained in:
Daniel Lugo 2021-12-16 11:11:11 -04:00
parent 5542d7b8db
commit 8e4d948172
4 changed files with 22 additions and 4 deletions

View file

@ -210,5 +210,11 @@ module.exports = {
authorizeDevice, authorizeDevice,
generateRandomString, generateRandomString,
nodeKeyPairs, nodeKeyPairs,
devicePublicKeys devicePublicKeys,
/**
* Used for tests.
*/
killECCCryptoSubprocess() {
cryptoSubprocess.kill()
}
} }

View file

@ -12,7 +12,8 @@ const {
decryptMessage, decryptMessage,
encryptMessage, encryptMessage,
generateKeyPair, generateKeyPair,
isAuthorizedDevice isAuthorizedDevice,
killECCCryptoSubprocess
} = require('./ECC') } = require('./ECC')
const uuid = () => { const uuid = () => {
@ -118,4 +119,6 @@ describe('ECC', () => {
expect(decrypted).toEqual(message) expect(decrypted).toEqual(message)
}) })
}) })
after(killECCCryptoSubprocess)
}) })

View file

@ -136,5 +136,11 @@ module.exports = {
convertBufferToBase64, convertBufferToBase64,
convertToEncryptedMessage, convertToEncryptedMessage,
convertToEncryptedMessageResponse, convertToEncryptedMessageResponse,
processKey processKey,
/**
* Used for tests.
*/
killCryptoCryptoSubprocess() {
cryptoSubprocess.kill()
}
} }

View file

@ -7,7 +7,8 @@ const expect = require('expect')
const { const {
generateRandomString, generateRandomString,
convertBase64ToBuffer, convertBase64ToBuffer,
convertBufferToBase64 convertBufferToBase64,
killCryptoCryptoSubprocess
} = require('./crypto') } = require('./crypto')
describe('crypto', () => { describe('crypto', () => {
@ -33,4 +34,6 @@ describe('crypto', () => {
expect(asStringAgain).toEqual(rnd) expect(asStringAgain).toEqual(rnd)
}) })
}) })
after(killCryptoCryptoSubprocess)
}) })