Sha256: 050740f6533701dd2c68a749417fbf8d278d51fe9b52ff74504ea6339b418ea1

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

describe JWE::Serialization::Compact do
  describe '#encode' do
    it 'returns components base64ed and joined with a dot' do
      components = %w[a b c d e]
      expect(JWE::Serialization::Compact.encode(*components)).to eq 'YQ.Yg.Yw.ZA.ZQ'
    end
  end

  describe '#decode' do
    it 'returns an array with the 5 components' do
      expect(JWE::Serialization::Compact.decode('YQ.Yg.Yw.ZA.ZQ')).to eq %w[a b c d e]
    end

    it 'raises an error when passed a badly formatted payload' do
      expect { JWE::Serialization::Compact.decode('YQ.YQ.Yg.Yw.ZA.ZQ') }.to raise_error(JWE::DecodeError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jwe-0.4.0 spec/jwe/serialization_spec.rb
jwe-0.3.1 spec/jwe/serialization_spec.rb