CEC-464 can filters forms (#118)
* can filters forms and lists * unit tests * updating warnings and tests * merge develop * fixed snapshots * update jest mocks * updating tests
This commit is contained in:
30
src/components/Contexts/__mocks__/CANFiltersContext.jsx
Normal file
30
src/components/Contexts/__mocks__/CANFiltersContext.jsx
Normal file
@@ -0,0 +1,30 @@
|
||||
let busy = false;
|
||||
let filters = [
|
||||
{
|
||||
can_id: "123",
|
||||
interval: 1000
|
||||
},
|
||||
{
|
||||
can_id: "456-789",
|
||||
interval: 2000
|
||||
},
|
||||
{
|
||||
can_id: "1",
|
||||
interval: 0
|
||||
},
|
||||
];
|
||||
let totalFilters = 3;
|
||||
|
||||
export const CANFiltersProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-canfiltersprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useCANFiltersContext = () => ({
|
||||
busy,
|
||||
filters,
|
||||
totalFilters,
|
||||
addFilter: jest.fn(),
|
||||
getFilters: jest.fn(),
|
||||
updateFilter: jest.fn(),
|
||||
deleteFilter: jest.fn(),
|
||||
});
|
||||
16
src/components/Contexts/__mocks__/StatusContext.jsx
Normal file
16
src/components/Contexts/__mocks__/StatusContext.jsx
Normal file
@@ -0,0 +1,16 @@
|
||||
let message = ""
|
||||
let title = ""
|
||||
let sitePath = {}
|
||||
|
||||
export const StatusProvider = ({ children }) => {
|
||||
return <div data-testid="mocked-statusprovider">{children}</div>;
|
||||
};
|
||||
|
||||
export const useStatusContext = () => ({
|
||||
message,
|
||||
title,
|
||||
sitePath,
|
||||
setMessage: jest.fn(m => message = m),
|
||||
setTitle: jest.fn(t => title = t),
|
||||
setSitePath: jest.fn(s => sitePath = s),
|
||||
});
|
||||
Reference in New Issue
Block a user