Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Sep 12, 2023
1 parent de54957 commit 7c8e0e8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
31 changes: 31 additions & 0 deletions type-plus/ts/array/array_plus.is_index_out_of_bound.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { it } from '@jest/globals'
import { testType, type ArrayPlus } from '../index.js'

it('returns true for never', () => {
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], never>>(true)
})

it('returns true for empty tuple', () => {
testType.true<ArrayPlus.IsIndexOutOfBound<[], never>>(true)
testType.true<ArrayPlus.IsIndexOutOfBound<[], 0>>(true)
})

it('return false for array', () => {
testType.false<ArrayPlus.IsIndexOutOfBound<any[], 0>>(true)
testType.false<ArrayPlus.IsIndexOutOfBound<any[], 1>>(true)
testType.false<ArrayPlus.IsIndexOutOfBound<any[], -1>>(true)
})

it('returns true for out of bound index', () => {
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], 1>>(true)
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], -2>>(true)
})

it('returns false for in bound index', () => {
testType.false<ArrayPlus.IsIndexOutOfBound<['a'], 0>>(true)
testType.false<ArrayPlus.IsIndexOutOfBound<['a'], -1>>(true)
})

it('supports readonly array', () => {
testType.true<ArrayPlus.IsIndexOutOfBound<readonly ['a'], 1>>(true)
})
32 changes: 0 additions & 32 deletions type-plus/ts/array/array_plus.is_is_index_out_of_bound.spec.ts

This file was deleted.

0 comments on commit 7c8e0e8

Please sign in to comment.