feat(types,utils): added promotion create with rules and application target rules (#5957)

* feat(types,utils): added promotion create with rules

* chore: add rules to promotion and application method

* chore: use common code for rule and values

* chore: address pr reviews

* chore: fix test
This commit is contained in:
Riqwan Thamir
2024-01-03 09:54:48 +01:00
committed by GitHub
parent d16d10619d
commit 42cc8ae3f8
33 changed files with 1560 additions and 122 deletions
@@ -0,0 +1,61 @@
import { isPresent } from "../is-present"
describe("isPresent", function () {
it("should return true or false for different types of data", function () {
const expectations = [
{
input: null,
output: false,
},
{
input: undefined,
output: false,
},
{
input: "Testing",
output: true,
},
{
input: "",
output: false,
},
{
input: {},
output: false,
},
{
input: { test: 1 },
output: true,
},
{
input: [],
output: false,
},
{
input: [{ test: 1 }],
output: true,
},
{
input: new Map([["test", "test"]]),
output: true,
},
{
input: new Map([]),
output: false,
},
{
input: new Set(["test"]),
output: true,
},
{
input: new Set([]),
output: false,
},
]
expectations.forEach((expectation) => {
expect(isPresent(expectation.input)).toEqual(expectation.output)
})
})
})