refactor common test helpers into test/

This way we can share them with multiple tests
This commit is contained in:
David Lechner
2020-06-10 21:59:34 -05:00
committed by David Lechner
parent 8ba4143fa7
commit 31c3e2b52e
16 changed files with 205 additions and 223 deletions
+1 -7
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { assert, hex, lookup } from '.';
import { assert, hex } from '.';
test('assert', () => {
const assertTrue = jest.fn(() => assert(true, 'should not throw'));
@@ -16,9 +16,3 @@ test('hex', () => {
expect(hex(1, 4)).toBe('0x0001');
expect(hex(2, 8)).toBe('0x00000002');
});
test('lookup', () => {
const obj = { a: { b: { c: 'd' } } };
expect(lookup(obj, 'a.b.c')).toBe('d');
expect(lookup(obj, 'a.x.y')).toBeUndefined();
});