Sha256: 973746c04eb536b0eefb2aa8b5f27a08c896c55701072f68560a54d4997e2c0f

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

describe JWE::Serialization::Compact do
  describe '#encode' do
    it 'returns components base64ed and joined with a dot' do
      components = [ '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 [ '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

1 entries across 1 versions & 1 rubygems

Version Path
jwe-0.1.0 spec/jwe/serialization_spec.rb