/// <reference types="cypress" />

import makeFakeUser from '../../factories/user';

describe('Session History', () => {
  const currentUser = makeFakeUser();
  beforeEach(() => {
    cy.stubAuthenticate({ id: currentUser.id });
  });

  describe('When user has no sessions', () => {
    it('should show no sessions message', () => {
      cy.intercept('GET', /\S+\/api\/sessions\/history/, {
        body: []
      }).as('fetchAllSessions')
      cy.visit('/sessions/history');
      cy.wait('@fetchAllSessions');
      cy.contains('No Records!');
    });
  });
});
