Skip to content

Commit

Permalink
test (analytics/value): update test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlasDiablo committed Dec 15, 2023
1 parent d6c04d9 commit c838dfd
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/analytics/test/value.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,42 @@ describe('value', () => {
});
});
});

describe('genrated data', () => {
const LENGHT = 1000;
let genratedData = [];

beforeEach(() => {
const data = [];
for (let i = 0; i < LENGHT; i += 1) {
data.push({
id: i,
value: i * 2,
});
}
genratedData = data;
});

it('should extract the id (path = id)', async () => {
ezs.use({ value });
const result = await runEzs(ezs, genratedData, 'id');

assert.deepStrictEqual(result.length, LENGHT);

for (let i = 0; i < LENGHT; i += 1) {
assert.deepStrictEqual(result[i], i);
}
});

it('should extract the value (path = value)', async () => {
ezs.use({ value });
const result = await runEzs(ezs, genratedData, 'value');

assert.deepStrictEqual(result.length, LENGHT);

for (let i = 0; i < LENGHT; i += 1) {
assert.deepStrictEqual(result[i], i * 2);
}
});
});
});

0 comments on commit c838dfd

Please sign in to comment.