Skip to content
Snippets Groups Projects
Select Git revision
  • 34a2bab750ba86ac170edbd47ba3b376fc25a904
  • master default protected
2 results

invisibleMaze.test.js

Blame
  • invisibleMaze.test.js 1.14 KiB
    import React from 'react';
    import { render } from '@testing-library/react';
    import '../../testing/mockRedux.js';
    
    import {
      selectStepOne,
      selectStepTwo,
      selectStepThree,
      selectButtonOne,
      selectButtonTwo,
      selectButtonThree,
    } from './invisibleMazeSlice.js';
    import { InvisibleMaze } from './invisibleMaze.js';
    jest.mock('./invisibleMazeSlice.js', () => ({
      selectStepOne: jest.fn().mockName('selectStepOne'),
      selectStepTwo: jest.fn().mockName('selectStepTwo'),
      selectStepThree: jest.fn().mockName('selectStepThree'), 
      selectButtonOne: jest.fn().mockName('selectButtonOne'),
      selectButtonTwo: jest.fn().mockName('selectButtonTwo'),
      selectButtonThree: jest.fn().mockName('selectButtonThree'),
    }));
    
    describe('the maze', () => {
      test('has a grid of 3x3 buttons', () => {
        selectStepOne.mockReturnValue(9998);
        selectStepTwo.mockReturnValue(9997);
        selectStepThree.mockReturnValue(9999);
        selectButtonOne.mockReturnValue(9998);
        selectButtonTwo.mockReturnValue(9997);
        selectButtonThree.mockReturnValue(9999);
        const { container } = render(
            <InvisibleMaze/>
        );
        expect(container).toMatchSnapshot();
      });
    });