Skip to content

Commit

Permalink
Update to a consistent Jest test function
Browse files Browse the repository at this point in the history
  • Loading branch information
queicherius committed Aug 8, 2023
1 parent 1a58d7a commit 8a52117
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { decrypt, encrypt } from '../src/index'
const KEY = 'gdPfTP7h1hcs1ySGp0vcFwIZVpWfUSqJ'

describe('aes-encryption', () => {
it('can encrypt and decrypt a string', () => {
test('can encrypt and decrypt a string', () => {
expect(decrypt(KEY, encrypt(KEY, 'FooBar'))).toEqual('FooBar')
expect(decrypt(KEY, encrypt(KEY, '👋 🤚 🖐'))).toEqual('👋 🤚 🖐')
})

it('does not produce the same output twice', () => {
test('does not produce the same output twice', () => {
const first = encrypt(KEY, 'FooBar')
const second = encrypt(KEY, 'FooBar')

Expand All @@ -17,15 +17,15 @@ describe('aes-encryption', () => {
expect(decrypt(KEY, second)).toEqual('FooBar')
})

it('errors for the wrong encryption key when decrypting', () => {
test('errors for the wrong encryption key when decrypting', () => {
const encrypted = encrypt(KEY, 'FooBar')

expect(() =>
decrypt('AAPfTP7h1hcs1ySGp0vcFwIZVpWfUSAA', encrypted)
).toThrowErrorMatchingSnapshot()
})

it('errors when a wrong key format is provided', () => {
test('errors when a wrong key format is provided', () => {
const encrypted = encrypt(KEY, 'FooBar')

expect(() =>
Expand All @@ -42,7 +42,7 @@ describe('aes-encryption', () => {
expect(() => encrypt([1, 2, 3], 'FooBar')).toThrowErrorMatchingSnapshot()
})

it('errors when a wrong input format is provided', () => {
test('errors when a wrong input format is provided', () => {
const encrypted = encrypt(KEY, 'FooBar')

// @ts-expect-error input has to be a string
Expand Down

0 comments on commit 8a52117

Please sign in to comment.