mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 11:04:49 +00:00
refactor common test helpers into test/
This way we can share them with multiple tests
This commit is contained in:
committed by
David Lechner
parent
8ba4143fa7
commit
31c3e2b52e
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user