mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix oplog converter case in which the value is an array but shouldnt be flattened
This commit is contained in:
committed by
Filipe Névola
parent
eb82e917a7
commit
d8fd0fb5ce
@@ -63,7 +63,7 @@ const nestedOplogEntryParsers = (
|
||||
|
||||
return {
|
||||
...acc,
|
||||
...(typeof setObjectSource[key] === 'object'
|
||||
...(!Array.isArray(setObjectSource[key]) && typeof setObjectSource[key] === 'object'
|
||||
? flattenObject({ [prefixedKey]: setObjectSource[key] })
|
||||
: {
|
||||
[prefixedKey]: setObjectSource[key],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { oplogV2V1Converter } from './oplog_v2_converter';
|
||||
|
||||
Tinytest.add('oplog - v2/v1 conversion', function(test) {
|
||||
Tinytest.only('oplog - v2/v1 conversion', function(test) {
|
||||
const entry1 = {
|
||||
$v: 2,
|
||||
diff: { scustom: { sEJSON$value: { u: { EJSONtail: 'd' } } } },
|
||||
@@ -33,6 +33,8 @@ Tinytest.add('oplog - v2/v1 conversion', function(test) {
|
||||
};
|
||||
const entry8 = { $v: 2, diff: { u: { c: 'bar' }, sb: { a: true, u0: 2 } } };
|
||||
|
||||
const entry9 = {"$v":2,"diff":{"sservices":{"sresume":{"u":{"loginTokens":[]}}}}};
|
||||
|
||||
test.equal(
|
||||
JSON.stringify(oplogV2V1Converter(entry1)),
|
||||
JSON.stringify({
|
||||
@@ -74,4 +76,8 @@ Tinytest.add('oplog - v2/v1 conversion', function(test) {
|
||||
JSON.stringify(oplogV2V1Converter(entry8)),
|
||||
JSON.stringify({ $v: 2, $set: { 'b.0': 2, c: 'bar' } })
|
||||
);
|
||||
test.equal(
|
||||
JSON.stringify(oplogV2V1Converter(entry9)),
|
||||
JSON.stringify({ '$v': 2, '$set': { 'services.resume.loginTokens': [] } })
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user