mirror of
https://github.com/scratchfoundation/scratch-analysis.git
synced 2025-02-26 15:03:52 -05:00
20 lines
425 B
JavaScript
20 lines
425 B
JavaScript
|
const test = require('tap').test;
|
||
|
const utility = require('../../lib/utility');
|
||
|
|
||
|
test('spec', t => {
|
||
|
t.type(utility, 'function');
|
||
|
t.type(utility.frequency, 'function');
|
||
|
t.end();
|
||
|
});
|
||
|
|
||
|
test('frequency', t => {
|
||
|
const input = ['foo', 'foo', 'foo', 'bar', 'bar', 'baz'];
|
||
|
const result = utility.frequency(input);
|
||
|
t.deepEqual(result, {
|
||
|
foo: 3,
|
||
|
bar: 2,
|
||
|
baz: 1
|
||
|
});
|
||
|
t.end();
|
||
|
});
|