Sha256: 05a3bd52314f8ceaeded96ccb53d10dc5cf30b01f8328fdd688af00873ff6f2e

Contents?: true

Size: 1.32 KB

Versions: 8

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

module LaunchDarkly
  module Impl
    module Model
      describe "model serialization" do
        it "serializes flag" do
          flag = { key: "flagkey", version: 1 }
          json = Model.serialize(FEATURES, flag)
          expect(JSON.parse(json, symbolize_names: true)).to eq flag
        end

        it "serializes segment" do
          segment = { key: "segkey", version: 1 }
          json = Model.serialize(SEGMENTS, segment)
          expect(JSON.parse(json, symbolize_names: true)).to eq segment
        end

        it "serializes arbitrary data kind" do
          thing = { key: "thingkey", name: "me" }
          json = Model.serialize({ name: "things" }, thing)
          expect(JSON.parse(json, symbolize_names: true)).to eq thing
        end

        it "deserializes flag with no rules or prerequisites" do
          flag_in = { key: "flagkey", version: 1 }
          json = Model.serialize(FEATURES, flag_in)
          flag_out = Model.deserialize(FEATURES, json)
          expect(flag_out).to eq flag_in
        end

        it "deserializes segment" do
          segment_in = { key: "segkey", version: 1 }
          json = Model.serialize(SEGMENTS, segment_in)
          segment_out = Model.deserialize(SEGMENTS, json)
          expect(segment_out).to eq segment_in
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
launchdarkly-server-sdk-6.2.4 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.2.3 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.2.2 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.2.1 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.2.0 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.1.1 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.1.0 spec/impl/model/serialization_spec.rb
launchdarkly-server-sdk-6.0.0 spec/impl/model/serialization_spec.rb