- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
32 lines
583 B
JavaScript
32 lines
583 B
JavaScript
'use strict'
|
|
|
|
const test = require('tape')
|
|
const SparseArray = require('../')
|
|
|
|
const max = 100
|
|
let arr
|
|
|
|
test('allows creation', (t) => {
|
|
arr = new SparseArray()
|
|
t.end()
|
|
})
|
|
|
|
test('allows pushing', (t) => {
|
|
for(let i = 0; i < max; i++) {
|
|
const pos = arr.push(i.toString())
|
|
t.equal(pos, i + 1)
|
|
}
|
|
t.end()
|
|
})
|
|
|
|
test('find foundable', (t) => {
|
|
const min = Math.floor(max / 2)
|
|
t.equal(arr.find(elem => Number(elem) >= min), min.toString())
|
|
t.end()
|
|
})
|
|
|
|
test('does not find unfoundable', (t) => {
|
|
t.equal(arr.find(elem => Number(elem) > max), undefined)
|
|
t.end()
|
|
})
|