feature/login-and-register-forms #2

Merged
ilia merged 12 commits from feature/login-and-register-forms into main 2026-03-24 18:00:42 +00:00
3 changed files with 23 additions and 0 deletions
Showing only changes of commit c006a94c4d - Show all commits

View File

@@ -1,2 +1,3 @@
export * from "./selectFormValid/selectFormValid";
export * from "./selectAuthData/selectAuthData";
export * from "./selectStatusIsLoading/selectStatusIsLoading";

View File

@@ -0,0 +1,18 @@
import { useAuthStore } from "../../stores";
import { selectStatusIsLoading } from "./selectStatusIsLoading";
describe("selectStatusIsLoading", () => {
afterEach(() => {
useAuthStore.getState().reset();
});
it("should return true when status is 'loading'", () => {
useAuthStore.setState({ status: "loading" });
expect(selectStatusIsLoading(useAuthStore.getState())).toBe(true);
});
it("should return false when status is not 'loading'", () => {
useAuthStore.setState({ status: "idle" });
expect(selectStatusIsLoading(useAuthStore.getState())).toBe(false);
});
});

View File

@@ -0,0 +1,4 @@
import type { AuthStore } from "../../types/store";
export const selectStatusIsLoading = (state: AuthStore) =>
state.status === "loading";