Rename contexts to Contexts

This commit is contained in:
jwu-fisker
2021-01-08 09:38:43 -08:00
parent f91aef7f4a
commit c51199111f
6 changed files with 0 additions and 0 deletions

View 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(),
});

View 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;
};