diff --git a/src/lib/contacts.spec.ts b/src/lib/contacts.spec.ts index 3a54ce5..ff92eec 100644 --- a/src/lib/contacts.spec.ts +++ b/src/lib/contacts.spec.ts @@ -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', () => { @@ -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); + }); + }); +});