MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestRevTreeUnmarshalOldFormat

Function TestRevTreeUnmarshalOldFormat

db/revtree_test.go:219–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestRevTreeUnmarshalOldFormat(t *testing.T) {
220 // 'channels' is an old revtree property that stored channel history for previous revisions.
221 // we moved non-winning leaf revision channel information into a 'channelMap' property instead to handle the case where documents are in conflict.
222 // bodies is an old revtree property that stored full bodies for previous revisions.
223 // we moved this into bodyMap for inline bodies and bodyKeyMap for externally stored bodies.
224 const testJSON = `{
225 "revs": ["3-three", "2-two", "1-one"],
226 "parents": [1, 2, -1],
227 "bodies": ["{\"foo\":\"bar\"}", "", ""],
228 "channels": [["ABC", "CBS"], null, ["ABC"]]
229}`
230 expected := testmap.copy()
231
232 // winning rev channel information no longer present in revtree,
233 // expect to drop it at unmarshal time if it's still in the raw JSON
234 ri, err := expected.getInfo("3-three")
235 require.NoError(t, err)
236 ri.Channels = nil
237
238 assertRevTreeUnmarshal(t, testJSON, expected)
239}
240
241func TestRevTreeUnmarshalOldFormatNonWinningRev(t *testing.T) {
242 // we moved non-winning leaf revision channel information into a 'channelMap' property instead to handle the case where documents are in conflict.

Callers

nothing calls this directly

Calls 3

assertRevTreeUnmarshalFunction · 0.85
getInfoMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected