fix: addresses issue with creating stories (#2442)

This commit is contained in:
Wyatt Johnson
2019-08-02 17:02:47 -04:00
committed by Kim Gardner
parent fdc6afec42
commit 4e548e8fbf
4 changed files with 78 additions and 21 deletions
+20 -5
View File
@@ -7,7 +7,7 @@ it("converts nested properties", () => {
};
const output = dotize(input);
expect(output).toEqual({
expect(output).toStrictEqual({
a: "property",
"can.be": "nested",
"can.really.deeply": "sometimes",
@@ -19,7 +19,7 @@ it("converts properties with dates", () => {
const input = { a: now, can: { be: now } };
const output = dotize(input);
expect(output).toEqual({
expect(output).toStrictEqual({
a: now,
"can.be": now,
});
@@ -35,7 +35,7 @@ it("converts array properties when enabled", () => {
};
const output = dotize(input);
expect(output).toEqual({
expect(output).toStrictEqual({
"a[0].property": "with",
"a[0].an": "array",
"a[1].value[0].sometimes": "nested",
@@ -53,7 +53,7 @@ it("does not converts array properties when disabled", () => {
};
const output = dotize(input, { ignoreArrays: true });
expect(output).toEqual({
expect(output).toStrictEqual({
"other.times": "not",
});
});
@@ -61,7 +61,22 @@ it("does not converts array properties when disabled", () => {
it("does convert array properties properly", () => {
expect(
dotize({ wordlist: { banned: ["banned"] } }, { embedArrays: true })
).toEqual({
).toStrictEqual({
"wordlist.banned": ["banned"],
});
});
it("does exclude undefined properties by default", () => {
expect(dotize({ test: { is: undefined, a: 1 } })).toStrictEqual({
"test.a": 1,
});
});
it("does include undefined properties when requested", () => {
expect(
dotize({ test: { is: undefined, a: 1 } }, { includeUndefined: true })
).toStrictEqual({
"test.a": 1,
"test.is": undefined,
});
});