mirror of
https://github.com/caprover/caprover
synced 2025-10-30 10:07:01 +00:00
Capping version chistory to 50
This commit is contained in:
53
tests/utils.test..ts
Normal file
53
tests/utils.test..ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import Utils from '../src/utils/Utils'
|
||||
|
||||
test('Testing dropFirstElements - larger', () => {
|
||||
const originalArray = []
|
||||
for (let index = 0; index < 20; index++) {
|
||||
originalArray.push('A' + index)
|
||||
}
|
||||
|
||||
expect(Utils.dropFirstElements(originalArray, 2).join(',')) //
|
||||
.toBe('A18,A19')
|
||||
})
|
||||
|
||||
test('Testing dropFirstElements - same', () => {
|
||||
const originalArray = []
|
||||
for (let index = 0; index < 2; index++) {
|
||||
originalArray.push('A' + index)
|
||||
}
|
||||
|
||||
expect(Utils.dropFirstElements(originalArray, 2).join(',')) //
|
||||
.toBe('A0,A1')
|
||||
})
|
||||
|
||||
test('Testing dropFirstElements - smaller', () => {
|
||||
const originalArray = []
|
||||
for (let index = 0; index < 2; index++) {
|
||||
originalArray.push('A' + index)
|
||||
}
|
||||
|
||||
expect(Utils.dropFirstElements(originalArray, 3).join(',')) //
|
||||
.toBe('A0,A1')
|
||||
})
|
||||
|
||||
|
||||
test('Testing dropFirstElements - smaller (1)', () => {
|
||||
const originalArray = []
|
||||
for (let index = 0; index < 1; index++) {
|
||||
originalArray.push('A' + index)
|
||||
}
|
||||
|
||||
expect(Utils.dropFirstElements(originalArray, 3).join(',')) //
|
||||
.toBe('A0')
|
||||
})
|
||||
|
||||
|
||||
test('Testing dropFirstElements - smaller (0)', () => {
|
||||
const originalArray = []
|
||||
for (let index = 0; index < 0; index++) {
|
||||
originalArray.push('A' + index)
|
||||
}
|
||||
|
||||
expect(Utils.dropFirstElements(originalArray, 3).join(',')) //
|
||||
.toBe('')
|
||||
})
|
||||
Reference in New Issue
Block a user