import { Dispatcher } from 'consus-core/flux';
import CheckoutStore from '../../../.dist/store/checkout-store';
import { assert } from 'chai';

describe('CheckoutStore', () => {

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

    it('should instantiate without any checkouts', () => {
        assert.lengthOf(CheckoutStore.getCheckouts(), 0);
    });

    it('should instantiate with any checkout errors', () => {
        assert.lengthOf(CheckoutStore.getCheckoutErrors(), 0);
    });

});

@@ -4,62 +4,195 @@
 ort 
-%7B Dispatcher %7D from 'consus-core/flux';%0Aimport Checkou
+CheckoutStore from '../../../.dist/store/checkout-store';%0Aimport ModelStore from '../../../.dist/store/model-store';%0Aimport ItemStore from '../../../.dist/store/item-store';%0Aimport Studen
 tSto
@@ -213,39 +213,38 @@
 /../.dist/store/
-checkou
+studen
 t-store';%0Aimport
@@ -272,111 +272,833 @@
 i';%0A
-%0Adescribe('CheckoutStore', () =%3E %7B%0A%0A    before(() =%3E %7B%0A        Dispatcher.handleAction('CLEAR_ALL_DATA'
+import %7B addAction %7D from '../../util/database';%0A%0Adescribe('CheckoutStore', () =%3E %7B%0A%0A    let items = %5B%5D;%0A    let student;%0A%0A    before(() =%3E %7B%0A        addAction('CLEAR_ALL_DATA');%0A        addAction('NEW_MODEL', %7B%0A            name: 'Resistor'%0A        %7D).then(actionId =%3E %7B%0A            let model = ModelStore.getModelByActionId(actionId);%0A            for (let i = 0; i %3C 3; i++) %7B%0A                addAction('NEW_ITEM', %7B%0A                    modelAddress: model.address%0A                %7D).then(actionId =%3E %7B%0A                    items.push(ItemStore.getItemByActionId(actionId));%0A                %7D);%0A            %7D%0A        %7D);%0A        addAction('NEW_STUDENT', %7B%0A            id: '123456',%0A            name: 'John von Neumann'%0A        %7D).then(actionId =%3E %7B%0A            student = StudentStore.getStudentByActionId(actionId);%0A        %7D
 );%0A 
@@ -1262,16 +1262,19 @@
 ate with
+out
  any che
@@ -1368,12 +1368,289 @@
    %7D);%0A%0A
+    it('should create a checkout', () =%3E %7B%0A        addAction('NEW_CHECKOUT', %7B%0A            studentId: student.id,%0A            items: %5Bitems%5B0%5D.address, items%5B1%5D.address%5D%0A        %7D).then(() =%3E %7B%0A            assert.lengthOf(CheckoutStore.getCheckouts(), 1);%0A        %7D);%0A    %7D);%0A%0A
 %7D);%0A

Test the checkout store