Download pool/shard000/JavaScript/0000014_sessionMap.test.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 598 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard000/JavaScript/0000014_sessionMap.test.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard000/JavaScript/0000014_sessionMap.test.js
-
curl -L -o 0000014_sessionMap.test.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard000/JavaScript/0000014_sessionMap.test.js
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') | |
| }) | |