diff --git a/src/tests/unit/status-badge.test.tsx b/src/tests/unit/status-badge.test.tsx
new file mode 100644
index 0000000000..cbfd7d3dfb
--- /dev/null
+++ b/src/tests/unit/status-badge.test.tsx
@@ -0,0 +1,170 @@
+import { configureStore, combineReducers } from "@reduxjs/toolkit";
+import React, { ReactNode } from "react";
+import { Provider } from "react-redux";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import { cleanup, render } from "@testing-library/react";
+import configReducer from "../../core/config.slice";
+import StatusBadge from "../../apps/loan-list/materials/utils/status-badge";
+
+const store = configureStore({
+ reducer: combineReducers({
+ config: configReducer
+ }),
+ preloadedState: {
+ config: {
+ data: {
+ expirationWarningDaysBeforeConfig: "6"
+ }
+ }
+ }
+});
+
+const Wrapper = ({ children }: { children: ReactNode }) => (
+ {children}
+);
+describe("Status Badge tests", () => {
+ afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ });
+
+ beforeEach(() => {
+ vi.useFakeTimers();
+ const date = new Date("2023-11-09T12:00:00+0100");
+ vi.setSystemTime(date);
+ });
+
+ test("Should not render anything if no props are given", () => {
+ const { getByTestId } = render(
+
+
+
+
+
+ );
+
+ const html = getByTestId("badge-wrapper");
+
+ expect(html).toMatchInlineSnapshot(`
+
+ `);
+ });
+
+ test("Expiring soon warning if within threshold", () => {
+ const { getByTestId } = render(
+
+
+
+
+
+ );
+
+ const html = getByTestId("badge-wrapper");
+
+ expect(html).toMatchInlineSnapshot(`
+
+ `);
+ });
+
+ test("No label if outside of threshold", () => {
+ const { getByTestId } = render(
+
+
+
+
+
+ );
+
+ const html = getByTestId("badge-wrapper");
+
+ expect(html).toMatchInlineSnapshot(`
+
+ `);
+ });
+
+ test("Same day should show 'Expiring soon'", () => {
+ const { getByTestId } = render(
+
+
+
+
+
+ );
+
+ const html = getByTestId("badge-wrapper");
+
+ expect(html).toMatchInlineSnapshot(`
+
+ `);
+ });
+
+ test("One day over should show 'Expired'", () => {
+ const { getByTestId } = render(
+
+
+
+
+
+ );
+
+ const html = getByTestId("badge-wrapper");
+
+ expect(html).toMatchInlineSnapshot(`
+
+ `);
+ });
+});