<commit_before>import { Dispatcher } from 'consus-core/flux';
import CheckinStore from '../../../.dist/store/checkin-store';
import { assert } from 'chai';

describe('CheckinStore', () => {

    before(() => {
        Dispatcher.handleAction('CLEAR_ALL_DATA');
    });

    it('should instantiate without any checkins', () => {
        assert.lengthOf(CheckinStore.getCheckins(), 0);
    });

    it('should instantiate with any checkin errors', () => {
        assert.lengthOf(CheckinStore.getCheckinErrors(), 0);
    });

});
<commit_msg>Test the checkin store<commit_after>import CheckinStore from '../../../.dist/store/checkin-store';
import ModelStore from '../../../.dist/store/model-store';
import ItemStore from '../../../.dist/store/item-store';
import StudentStore from '../../../.dist/store/student-store';
import { assert } from 'chai';
import { addAction } from '../../util/database';

describe('CheckinStore', () => {

    let model;
    let items = [];
    let student;

    before(() => {
        return addAction('CLEAR_ALL_DATA').then(() => {
            return addAction('NEW_MODEL', {
                name: 'Resistor'
            });
        }).then(actionId => {
            model = ModelStore.getModelByActionId(actionId);
            return addAction('NEW_ITEM', {
                modelAddress: model.address
            });
        }).then(actionId => {
            items.push(ItemStore.getItemByActionId(actionId));
            return addAction('NEW_ITEM', {
                modelAddress: model.address
            });
        }).then(actionId => {
            items.push(ItemStore.getItemByActionId(actionId));
            return addAction('NEW_ITEM', {
                modelAddress: model.address
            });
        }).then(actionId => {
            items.push(ItemStore.getItemByActionId(actionId));
            return addAction('NEW_ITEM', {
                modelAddress: model.address
            });
        }).then(() => {
            return addAction('NEW_STUDENT', {
                id: '123456',
                name: '<NAME>'
            });
        }).then(actionId => {
            student = StudentStore.getStudentByActionId(actionId);
            return addAction('NEW_CHECKOUT', {
                studentId: student.id,
                itemAddresses: [items[0].address, items[2].address]
            });
        });
    });

    it('should instantiate without any checkins', () => {
        assert.lengthOf(CheckinStore.getCheckins(), 0);
    });

    it('should instantiate with any checkin errors', () => {
        assert.lengthOf(CheckinStore.getCheckinErrors(), 0);
    });

    it('should create a checkin', () => {
        return addAction('CHECKIN', {
            studentId: student.id,
            itemAddress: items[0].address
        }).then(actionId => {
            assert.isObject(CheckinStore.getCheckinByActionId(actionId));
            assert.lengthOf(CheckinStore.getCheckins(), 1);
        });
    });

    it('should create another checkin', () => {
        return addAction('CHECKIN', {
            studentId: student.id,
            itemAddress: items[2].address
        }).then(actionId => {
            assert.isObject(CheckinStore.getCheckinByActionId(actionId));
            assert.lengthOf(CheckinStore.getCheckins(), 2);
        });
    });

});

{'fraction_non_alphanumeric': 0.15818017475143115, 'fraction_numerical': 0.004820729135281711, 'mean_word_length': 2.0970149253731343, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 23, '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': '6064113', 'n_tokens_mistral': 941, 'n_tokens_neox': 910, 'n_words': 156}