mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
771 B
30 lines
771 B
5 years ago
|
const sourceObject = {
|
||
|
num: 42,
|
||
|
bool: true,
|
||
|
str: 'some text',
|
||
|
log: console.log,
|
||
|
}
|
||
|
// /*/ // ⚡
|
||
|
export const tests = []
|
||
|
const t = (f) => tests.push(f)
|
||
|
|
||
|
// Get
|
||
|
t(({ eq }) => eq(typeof get, 'function'))
|
||
|
t(({ eq }) => eq(typeof get, 'function'))
|
||
|
t(({ eq }) => eq(get('num'), 42))
|
||
|
t(({ eq }) => eq(get('bool'), true))
|
||
|
t(({ eq }) => eq(get('str'), 'some text'))
|
||
|
t(({ eq }) => eq(get('log'), console.log))
|
||
|
t(({ eq }) => eq(get('noexist'), undefined))
|
||
|
|
||
|
// Set
|
||
|
t(({ eq }) => eq(typeof set, 'function'))
|
||
|
t(({ eq }) => eq(set('num', 55), 55))
|
||
|
t(({ eq }) => eq(set('noexist', 'nice'), 'nice'))
|
||
|
t(({ eq }) => eq(get('num'), 55))
|
||
|
t(({ eq }) => eq(get('noexist'), 'nice'))
|
||
|
t(({ eq }) => eq(set('log'), undefined))
|
||
|
t(({ eq }) => eq(get('log'), undefined))
|
||
|
|
||
|
Object.freeze(tests)
|