try improve performance

This commit is contained in:
2023-06-13 15:56:06 +01:00
parent 7992601f46
commit 79011f8ca2
6 changed files with 86 additions and 41 deletions

View File

@ -112,38 +112,46 @@ describe('canMerge', () => {
it("should have 0 distance", () => {
const a = {
ids: "a",
keys: 1
};
const b = {
ids: "a",
keys: 1
};
expect(canMergeFilters(a, b)).toEqual(true);
});
it("should have 1 distance", () => {
const a = {
ids: "a",
keys: 1
};
const b = {
ids: "b",
keys: 1
};
expect(canMergeFilters(a, b)).toEqual(true);
});
it("should have 10 distance", () => {
const a = {
ids: "a",
keys: 1
};
const b = {
ids: "a",
kinds: 1,
keys: 2
};
expect(canMergeFilters(a, b)).toEqual(false);
});
it("should have 11 distance", () => {
const a = {
ids: "a",
keys: 1
};
const b = {
ids: "b",
kinds: 1,
keys: 2
};
expect(canMergeFilters(a, b)).toEqual(false);
});
@ -152,13 +160,13 @@ describe('canMerge', () => {
since: 1,
until: 100,
kinds: [1],
authors: ["kieran", "snort", "c", "d", "e"],
authors: ["kieran", "snort", "c", "d", "e"]
};
const b = {
since: 1,
until: 100,
kinds: [6969],
authors: ["kieran", "snort", "c", "d", "e"],
authors: ["kieran", "snort", "c", "d", "e"]
};
expect(canMergeFilters(a, b)).toEqual(true);
});
@ -167,14 +175,14 @@ describe('canMerge', () => {
since: 1,
until: 100,
kinds: [1],
authors: ["f", "kieran", "snort", "c", "d"],
authors: ["f", "kieran", "snort", "c", "d"]
};
const b = {
since: 1,
until: 100,
kinds: [1],
authors: ["kieran", "snort", "c", "d", "e"],
authors: ["kieran", "snort", "c", "d", "e"]
};
expect(canMergeFilters(a, b)).toEqual(true);
});
})
})