|
| 1 | +import { mergeNoEval } from "../no-eval"; |
| 2 | + |
| 3 | +describe(mergeNoEval, () => { |
| 4 | + test("neither options existing", () => { |
| 5 | + const result = mergeNoEval(undefined, undefined); |
| 6 | + |
| 7 | + expect(result).toEqual([]); |
| 8 | + }); |
| 9 | + |
| 10 | + test("neither allowIndirect existing", () => { |
| 11 | + const result = mergeNoEval([{}], [{}]); |
| 12 | + |
| 13 | + expect(result).toEqual([{}]); |
| 14 | + }); |
| 15 | + |
| 16 | + test("original allowIndirect existing", () => { |
| 17 | + const result = mergeNoEval([{ allowIndirect: true }], [{}]); |
| 18 | + |
| 19 | + expect(result).toEqual([{}]); |
| 20 | + }); |
| 21 | + |
| 22 | + test("new allowIndirect existing", () => { |
| 23 | + const result = mergeNoEval([{}], [{ allowIndirect: true }]); |
| 24 | + |
| 25 | + expect(result).toEqual([{}]); |
| 26 | + }); |
| 27 | + |
| 28 | + test("original allowIndirect is false but new allowIndirect is true", () => { |
| 29 | + const result = mergeNoEval([{ allowIndirect: false }], [{ allowIndirect: true }]); |
| 30 | + |
| 31 | + expect(result).toEqual([{}]); |
| 32 | + }); |
| 33 | + |
| 34 | + test("original allowIndirect is true but new allowIndirect is false", () => { |
| 35 | + const result = mergeNoEval([{ allowIndirect: true }], [{ allowIndirect: false }]); |
| 36 | + |
| 37 | + expect(result).toEqual([{}]); |
| 38 | + }); |
| 39 | + |
| 40 | + test("both allowIndirect are true", () => { |
| 41 | + const result = mergeNoEval([{ allowIndirect: true }], [{ allowIndirect: true }]); |
| 42 | + |
| 43 | + expect(result).toEqual([{ allowIndirect: true }]); |
| 44 | + }); |
| 45 | +}); |
0 commit comments