import { getMinimalMe } from '../../../support/helpers';

describe('Sidebar', () => {
  beforeEach(() => {
    cy.setup();
  });

  it('should open sidebar and stay open', () => {
    const { me } = getMinimalMe({});
    const operations = {
      MeQuery: {
        me: {
          ...me,
          schoolClasses: [...me.schoolClasses, {}],
        },
      },
      ProjectsQuery: {
        projects: [],
      },
    };

    cy.mockGraphqlOps({
      operations,
    });

    cy.visit('/portfolio');
    cy.getByDataCy('sidebar').should('not.exist');
    cy.getByDataCy('user-widget-avatar').click();
    cy.getByDataCy('sidebar').should('exist');
    cy.getByDataCy('class-selection').click();
    cy.getByDataCy('class-selection-entry').should('have.length', 2);
    cy.getByDataCy('close-profile-sidebar-link').click();
    cy.getByDataCy('sidebar').should('not.exist');
  });
});
