mirror of
https://github.com/tabler/tabler.git
synced 2026-08-29 13:21:29 +04:00
13 lines
377 B
TypeScript
13 lines
377 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { requireIndex } from './array'
|
|
|
|
describe('requireIndex', () => {
|
|
it('returns the entry at the given index', () => {
|
|
expect(requireIndex(['a', 'b', 'c'], 1)).toBe('b')
|
|
})
|
|
|
|
it('throws when the index is out of bounds', () => {
|
|
expect(() => requireIndex(['a'], 5)).toThrow('Expected an entry at index 5')
|
|
})
|
|
})
|