Skip to content

Instantly share code, notes, and snippets.

@Israel-Miles
Created October 31, 2020 21:15
Show Gist options
  • Save Israel-Miles/dd05043954c61a2d5b9fba2b2011068c to your computer and use it in GitHub Desktop.
Save Israel-Miles/dd05043954c61a2d5b9fba2b2011068c to your computer and use it in GitHub Desktop.
aes-spec
import { TestBed } from '@angular/core/testing';
import { EncryptionService } from './encryption.service';
describe('EncryptionService', () => {
let service: EncryptionService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(EncryptionService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
it('should encrypt a string', () => {
const secretMessage = "This is a secret message!";
const encryptedMessage = service.encrypt(secretMessage)
console.log("Secret Message: " + secretMessage);
console.log("Encrypted Message: " + encryptedMessage);
const decryptedMessage = service.decrypt(encryptedMessage);
console.log("Decrypted Message: " + decryptedMessage);
expect(encryptedMessage).not.toEqual(secretMessage);
expect(decryptedMessage).toEqual(secretMessage);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment