New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bbpr

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbpr - npm Package Compare versions

Comparing version 3.4.6 to 3.4.7

4

lib/crypt.js

@@ -25,4 +25,6 @@ const crypto = require('crypto')

cachePwd,
cipher,
crypt,
decrypt
decrypt,
decipher
}

@@ -55,3 +55,3 @@ {

},
"version": "3.4.6"
"version": "3.4.7"
}

@@ -5,2 +5,68 @@ describe('crypt.js', () => {

})
describe('after require', () => {
const fs = require('fs')
const crypto = require('crypto')
const testText = 'testText'
const testTextCiphered = 'testTextCiphered'
const testTextDeciphered = 'testTextDeciphered'
let readFileSync
let writeFileSync
let cipherUpdate
let cipherFinal
let decipherUpdate
let decipherFinal
let crypt
beforeEach(() => {
readFileSync = spyOn(fs, 'readFileSync').and.returnValue('configuration file converted in string and password: null')
writeFileSync = spyOn(fs, 'writeFileSync')
crypt = require('../../lib/crypt')
cipherUpdate = spyOn(crypt.cipher, 'update').and.returnValue(testTextCiphered)
cipherFinal = spyOn(crypt.cipher, 'final').and.returnValue('')
decipherUpdate = spyOn(crypt.decipher, 'update').and.returnValue(testTextDeciphered)
decipherFinal = spyOn(crypt.decipher, 'final').and.returnValue('')
})
describe('cachePwd', () => {
it('should write to a bbpr.config.js file a configuration containing the encrypted password', () => {
crypt.cachePwd('encryptedpassword')
expect(writeFileSync.calls.mostRecent().args[0]).toContain('bbpr.config.js')
expect(writeFileSync.calls.mostRecent().args[1]).toContain('encryptedpassword')
})
})
describe('crypt', () => {
it('should cipher update the text provided ', () => {
crypt.crypt(testText)
expect(cipherUpdate.calls.mostRecent().args[0]).toContain(testText)
})
it('should cipher final once', () => {
crypt.crypt(testText)
expect(cipherFinal).toHaveBeenCalledTimes(1)
})
it('should return the ciphered text', () => {
expect(crypt.crypt(testText)).toEqual(testTextCiphered)
})
})
describe('decrypt', () => {
it('should decipher update the text provided ', () => {
crypt.decrypt(testText)
expect(decipherUpdate.calls.mostRecent().args[0]).toContain(testText)
})
it('should cipher final once', () => {
crypt.decrypt(testText)
expect(decipherFinal).toHaveBeenCalledTimes(1)
})
it('should return the ciphered text', () => {
expect(crypt.decrypt(testText)).toEqual(testTextDeciphered)
})
})
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc