pipelines_store_spec.js.es6 693 Bytes
Newer Older
Filipa Lacerda's avatar
Filipa Lacerda committed
1
const PipelinesStore = require('~/commit/pipelines/pipelines_store');
2 3

describe('Store', () => {
Mike Greiling's avatar
Mike Greiling committed
4
  let store;
5 6

  beforeEach(() => {
Filipa Lacerda's avatar
Filipa Lacerda committed
7
    store = new PipelinesStore();
8 9
  });

10 11 12
  // unregister intervals and event handlers
  afterEach(() => gl.VueRealtimeListener.reset());

13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  it('should start with a blank state', () => {
    expect(store.state.pipelines.length).toBe(0);
  });

  it('should store an array of pipelines', () => {
    const pipelines = [
      {
        id: '1',
        name: 'pipeline',
      },
      {
        id: '2',
        name: 'pipeline_2',
      },
    ];

Mike Greiling's avatar
Mike Greiling committed
29
    store.storePipelines(pipelines);
30 31 32 33

    expect(store.state.pipelines.length).toBe(pipelines.length);
  });
});