mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Merge branch 'fix-custom-context-mock' into 'dev'
Fix custom context mock See merge request turris/reforis/foris-js!207
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
 | 
			
		||||
 * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
 | 
			
		||||
 *
 | 
			
		||||
 * This is free software, licensed under the GNU General Public License v3.
 | 
			
		||||
 * See /LICENSE for more information.
 | 
			
		||||
@@ -64,7 +64,7 @@ DeviceForm.propTypes = {
 | 
			
		||||
        guest_wifi: PropTypes.object.isRequired,
 | 
			
		||||
        encryption: PropTypes.string.isRequired,
 | 
			
		||||
        available_bands: PropTypes.array.isRequired,
 | 
			
		||||
        ieee80211w_disabled: PropTypes.bool.isRequired,
 | 
			
		||||
        ieee80211w_disabled: PropTypes.bool,
 | 
			
		||||
    }),
 | 
			
		||||
    formErrors: PropTypes.object.isRequired,
 | 
			
		||||
    setFormValue: PropTypes.func.isRequired,
 | 
			
		||||
 
 | 
			
		||||
@@ -25,13 +25,13 @@ Wrapper.propTypes = {
 | 
			
		||||
 | 
			
		||||
function Wrapper({ children }) {
 | 
			
		||||
    return (
 | 
			
		||||
        <AlertContextMock>
 | 
			
		||||
        <CustomizationContextMock>
 | 
			
		||||
            <AlertContextMock>
 | 
			
		||||
                <StaticRouter>
 | 
			
		||||
                    <UIDReset>{children}</UIDReset>
 | 
			
		||||
                </StaticRouter>
 | 
			
		||||
            </CustomizationContextMock>
 | 
			
		||||
            </AlertContextMock>
 | 
			
		||||
        </CustomizationContextMock>
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,12 +9,23 @@ import React from "react";
 | 
			
		||||
 | 
			
		||||
window.CustomizationContext = React.createContext();
 | 
			
		||||
 | 
			
		||||
const deviceDetails = {};
 | 
			
		||||
const isCustomized = jest.fn();
 | 
			
		||||
const deviceDetails = {
 | 
			
		||||
    kernel: "5.x.x",
 | 
			
		||||
    model: "Turris Omnia",
 | 
			
		||||
    os_branch: {
 | 
			
		||||
        mode: "branch",
 | 
			
		||||
        value: "hbs",
 | 
			
		||||
    },
 | 
			
		||||
    os_version: "6.x.x",
 | 
			
		||||
    reforis_version: "1.x.x",
 | 
			
		||||
    serial: 123456789,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const isCustomized = false;
 | 
			
		||||
 | 
			
		||||
function CustomizationContextMock({ children }) {
 | 
			
		||||
    return (
 | 
			
		||||
        <CustomizationContext.Provider value={(deviceDetails, isCustomized)}>
 | 
			
		||||
        <CustomizationContext.Provider value={{ deviceDetails, isCustomized }}>
 | 
			
		||||
            {children}
 | 
			
		||||
        </CustomizationContext.Provider>
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user