Skip to content

Comments

Add test to check ID uniqueness#1

Open
junaidkbr wants to merge 4 commits intomasterfrom
feature/add-unique-id-test
Open

Add test to check ID uniqueness#1
junaidkbr wants to merge 4 commits intomasterfrom
feature/add-unique-id-test

Conversation

@junaidkbr
Copy link
Owner

No description provided.


data.forEach((tasbih) => {
test(`verifying tasbih with id ${tasbih.id} to be unique`, () => {
expect(tasbihIds.includes(tasbih.id)).toBe(true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be false? If tasbihIds already include an ID, it means we have found a duplicate. The toBe should take false instead of true.

});
/* eslint-disable */
const data = require('../src/scripts/data/data.json');
let tasbihIds = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use Set instead of array too, for now it don't really matter as the data set is very small but something to keep in mind later down the road.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants