Skip to content

Commit

Permalink
Add subitems to specs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatjazKavcic committed May 5, 2023
1 parent 8b9aec6 commit 4c9787f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/diffcrypt/encryptor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_it_decrypts_nested_structures
data:
array:
- item1: 7HJjrwQ6KqH+jvu1pOZGqQ==--E2ipnCNCszD6oixM--QZapG/8wrPtwbUVDe9evsw==
subitem: oNNLBGwL45VvOv7elkRTHZTcNQ==--iFBc53R3F26zsvTK--6iEtqH7TR7TSS6fJOHwfPg==
- item2: IvwdxcAV+38MvNsKYdNCEg==--6y7Aj4nmFLOTGrx3--rRH8ni3yks2eid91jde2hg==
secret_key_base: 88Ry6HESUoXBr6QUFXmni9zzfCIYt9qGNFvIWFcN--4xoecI5mqbNRBibI--62qPJbkzzh5h8lhFEFOSaQ==
aws:
Expand All @@ -58,6 +59,7 @@ def test_it_decrypts_nested_structures
---
array:
- item1: value1
subitem: value sub
- item2: value2
secret_key_base: secret_key_base_test
aws:
Expand All @@ -74,10 +76,13 @@ def test_it_encrypts_nested_structures
aws:
access_key_id: AKIAXXX
array:
- item1: value1
- item2: value2
- item1: value1
subitem: value sub
- item2: value2
CONTENT
expected_pattern = /---\narray:\n- item1: #{ENCRYPTED_VALUE_PATTERN}\n- item2: #{ENCRYPTED_VALUE_PATTERN}\naws:\n access_key_id: #{ENCRYPTED_VALUE_PATTERN}\nsecret_key_base: #{ENCRYPTED_VALUE_PATTERN}/
expected_pattern = /---\narray:\n- item1: #{ENCRYPTED_VALUE_PATTERN}\n subitem: #{ENCRYPTED_VALUE_PATTERN}\n- item2: #{ENCRYPTED_VALUE_PATTERN}\naws:\n access_key_id: #{ENCRYPTED_VALUE_PATTERN}\nsecret_key_base: #{ENCRYPTED_VALUE_PATTERN}/

pp Diffcrypt::Encryptor.new(TEST_KEY_128, cipher: 'aes-128-gcm').encrypt_data(content).to_yaml

assert_match expected_pattern, Diffcrypt::Encryptor.new(TEST_KEY_128, cipher: 'aes-128-gcm').encrypt_data(content).to_yaml
end
Expand Down

0 comments on commit 4c9787f

Please sign in to comment.