<commit_before>
import React from 'react';
import { shallow, render } from 'enzyme';
import chaiEnzyme from 'chai-enzyme';
import chai, { expect } from 'chai';

import GameMenu from '../../../client/jsx/game-menu';

chai.use(chaiEnzyme());

// Props with non-default values passes to the component
const props = {
    width: 80,
    height: 28,
    menuObj: {}
};

describe('Component <GameMenu>', () => {
    it('should render', () => {
        const wrapper = shallow(<GameMenu {...props} />);
        expect(wrapper, 'Component must render with shallow').to.have.length(1);
    });

    it('has one span per rendered text row', () => {
        const wrapper = shallow(<GameMenu {...props} />);
        const spans = wrapper.find('span');
        expect(spans).to.have.length(props.height);

        const spanElemProps = spans.get(0).props;
        expect(spanElemProps.dangerouslySetInnerHTML.__html)
            .to.have.length.above(79);
    });
});<commit_msg>Added a unit test to check that actorClass menu object is rendered properly.<commit_after>
import React from 'react';
import { shallow } from 'enzyme';
import chaiEnzyme from 'chai-enzyme';
import chai, { expect } from 'chai';

import GameMenu from '../../../client/jsx/game-menu';

const RG = require('../../../client/src/battles');
const ActorClass = require('../../../client/src/actor-class');

chai.use(chaiEnzyme());

// Props with non-default values passes to the component
const props = {
    width: 80,
    height: 28,
    menuObj: {}
};

describe('Component <GameMenu>', () => {
    it('should render', () => {
        const wrapper = shallow(<GameMenu {...props} />);
        expect(wrapper, 'Component must render with shallow').to.have.length(1);
    });

    it('has one span per rendered text row', () => {
        const wrapper = shallow(<GameMenu {...props} />);
        const spans = wrapper.find('span');
        expect(spans).to.have.length(props.height);

        const spanElemProps = spans.get(0).props;
        expect(spanElemProps.dangerouslySetInnerHTML.__html)
            .to.have.length.above(79);
    });

    it('shows the level info when leveling up', () => {
        const actor = new RG.Actor.Rogue('leveler');
        actor.get('Experience').setExpLevel(4);
        const actorClass = new ActorClass.Adventurer(actor);
        actorClass.advanceLevel();

        const menuObjItem = ActorClass.getLevelUpObject(4, actorClass);
        const menuObj = menuObjItem.getMenu();
        menuObj.post = ['Rendered as post-menu item'];
        const props = {
            width: 80, height: 28, menuObj
        };
        const wrapper = shallow(<GameMenu {...props} />);
        const spanElems = wrapper.find('span');
        for (let i = 0; i < 10; i++) {
            const spanElem = spanElems.get(i);
            const text = spanElem.props.dangerouslySetInnerHTML.__html;
            console.log(text);
        }
    });
});
{'fraction_non_alphanumeric': 0.16039671682626538, 'fraction_numerical': 0.008549931600547196, 'mean_word_length': 2.7072243346007605, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2538501', 'n_tokens_mistral': 909, 'n_tokens_neox': 858, 'n_words': 220}