mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
add tests for licenses reducers
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
import { Action } from '../actions';
|
||||
import { didFetchList, select } from './actions';
|
||||
import reducers, { LicenseInfo, LicenseList } from './reducers';
|
||||
|
||||
type State = ReturnType<typeof reducers>;
|
||||
|
||||
test('initial state', () => {
|
||||
expect(reducers(undefined, {} as Action)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"list": null,
|
||||
"selected": null,
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
test('list', () => {
|
||||
const list = [] as LicenseList;
|
||||
expect(reducers({ list: null } as State, didFetchList(list)).list).toBe(list);
|
||||
});
|
||||
|
||||
test('selected', () => {
|
||||
const info = {} as LicenseInfo;
|
||||
expect(reducers({ selected: null } as State, select(info)).selected).toBe(info);
|
||||
});
|
||||
Reference in New Issue
Block a user