sajaniemi_variable_dataset_large / pool /shard000 /JavaScript /0000014_sessionMap.test.js
Pendigard's picture
Upload folder using huggingface_hub (part 13)
5893f8f verified
Raw History Blame Contribute Delete
598 Bytes
import test from 'ava'
import SessionMap from '../lib/sessionMap.js'
const sMp = new SessionMap()
const initValue = {
n: 1,
obj: {
s: 'alex',
n: 2
},
arr: [1, 2, 3, 4],
name: 'bb'
}
test.before(t => {
sMp.update('a', initValue)
})
test('sessionMap get', t => {
t.deepEqual(sMp.get('a'), initValue)
})
test('sessionMap find', t => {
t.deepEqual(sMp.find('n', 1)[0], initValue)
})
test('sessionMap getValue', t => {
t.is(sMp.getValue('a.obj.s'), 'alex')
})
test('sessionMap update', t => {
sMp.update('a.obj.s', 'erdun')
t.is(sMp.getValue('a.obj.s'), 'erdun')
})