Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/lib/contacts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { contacts } from './contacts';
import { contacts, contactsById } from './contacts';

describe('contacts', () => {
it('should be a non-empty array of objects', () => {
Expand Down Expand Up @@ -28,3 +28,15 @@ describe('contacts', () => {
});
});
});

describe('contactsById', () => {
it('should contain the same number of items as contacts array', () => {
expect(Object.keys(contactsById).length).toBe(contacts.length);
});

it('should map each contact id to its corresponding contact object', () => {
contacts.forEach((contact) => {
expect(contactsById[contact.id]).toBe(contact);
});
});
});
Loading