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