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

describe('ModelStore', () => {

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

    it('should instantiate without any models', () => {
        assert.lengthOf(ModelStore.getModels(), 0);
    });

});

@@ -1,51 +1,4 @@
-import %7B Dispatcher %7D from 'consus-core/flux';%0A
 impo
@@ -82,16 +82,65 @@
  'chai';
+%0Aimport %7B addAction %7D from '../../util/database';
 %0A%0Adescri
@@ -165,16 +165,32 @@
 ) =%3E %7B%0A%0A
+    let model;%0A%0A
     befo
@@ -212,25 +212,11 @@
     
-Dispatcher.handle
+add
 Acti
@@ -363,12 +363,755 @@
    %7D);%0A%0A
+    it('should create a model an retrieve it by the action id', () =%3E %7B%0A        addAction('NEW_MODEL', %7B%0A            name: 'Transistor'%0A        %7D).then(actionId =%3E %7B%0A            model = ModelStore.getModelByActionId(actionId);%0A        %7D);%0A        assert.lengthOf(ModelStore.getModels(), 1);%0A    %7D);%0A%0A    it('should retrieve a model by address', () =%3E %7B%0A        assert.strictEqual(ModelStore.getModelByAddress(model.address), model);%0A    %7D);%0A%0A    it('should create more models', () =%3E %7B%0A        addAction('NEW_MODEL', %7B%0A            name: 'Resistor'%0A        %7D);%0A        assert.lengthOf(ModelStore.getModels(), 2);%0A        addAction('NEW_MODEL', %7B%0A            name: 'Wire'%0A        %7D);%0A        assert.lengthOf(ModelStore.getModels(), 3);%0A    %7D);%0A%0A
 %7D);%0A

Test the model store