/*
 * File: dashboardSlice.test.ts
 * Description: Test for dashboardSlice reducer
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */

import reducer, { fetchCasesSuccess, fetchCasesFailure } from '../redux/dashboardSlice';

const initialState = {
  caseQueue: [],
  loading: false,
  error: null,
};

describe('dashboardSlice', () => {
  it('handles fetchCasesSuccess', () => {
    const cases = [{ id: '1', patientName: 'John Doe', status: 'critical', aiConfidence: 93, description: 'Head trauma' }];
    const state = reducer(initialState, fetchCasesSuccess(cases));
    expect(state.caseQueue).toEqual(cases);
    expect(state.loading).toBe(false);
    expect(state.error).toBeNull();
  });

  it('handles fetchCasesFailure', () => {
    const error = 'Failed to fetch';
    const state = reducer(initialState, fetchCasesFailure(error));
    expect(state.loading).toBe(false);
    expect(state.error).toBe(error);
  });
});

/*
 * End of File: dashboardSlice.test.ts
 * Design & Developed by Tech4Biz Solutions
 * Copyright (c) Spurrin Innovations. All rights reserved.
 */ 