Rename contexts to Contexts
This commit is contained in:
21
src/components/Contexts/__mocks__/FileUploadContext.jsx
Normal file
21
src/components/Contexts/__mocks__/FileUploadContext.jsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
|
||||
let uploading = false;
|
||||
let progress = 0;
|
||||
let status = null;
|
||||
|
||||
export const FileUploadProvider = ({ children }) => {
|
||||
return (
|
||||
<div data-testid="mocked-fileuploadprovider">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const useFileUploadContext = () => ({
|
||||
uploading,
|
||||
progress,
|
||||
status,
|
||||
upload: jest.fn(),
|
||||
cancel: jest.fn(),
|
||||
});
|
||||
35
src/components/Contexts/__mocks__/UserContext.jsx
Normal file
35
src/components/Contexts/__mocks__/UserContext.jsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
|
||||
let token = null;
|
||||
let fetching = false;
|
||||
let error = null;
|
||||
|
||||
export const UserProvider = ({ children }) => {
|
||||
return (
|
||||
<div data-testid="mocked-userprovider">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const useUserContext = () => ({
|
||||
token,
|
||||
fetching,
|
||||
error,
|
||||
setError: jest.fn(),
|
||||
signIn: jest.fn(),
|
||||
signUp: jest.fn(),
|
||||
signOut: jest.fn(),
|
||||
});
|
||||
|
||||
export const setToken = (val) => {
|
||||
token = val;
|
||||
};
|
||||
|
||||
export const setFetching = (val) => {
|
||||
fetching = val;
|
||||
};
|
||||
|
||||
export const setError = (val) => {
|
||||
error = val;
|
||||
};
|
||||
Reference in New Issue
Block a user