import {TestBed, async} from '@angular/core/testing';

import {Observable} from 'rxjs';

import { EffectsModule } from '@ngrx/effects';
import {StoreModule} from '@ngrx/store';
import {provideMockActions} from '@ngrx/effects/testing';

import { NxModule } from '@nrwl/nx';
import {DataPersistence} from '@nrwl/nx';
import {hot} from '@nrwl/nx/testing';

import { <%= className %>Effects } from './<%= fileName %>.effects';
import { Load<%= className %>, <%= className %>Loaded } from './<%= fileName %>.actions';

describe('<%= className %>Effects', () => {
  let actions: Observable<any>;
  let effects: <%= className %>Effects;

  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [
        NxModule.forRoot(),
        StoreModule.forRoot({}),
        EffectsModule.forRoot([])
      ],
      providers: [
        <%= className %>Effects,
        DataPersistence,
        provideMockActions(() => actions)
      ],
    });

    effects = TestBed.get(<%= className %>Effects);
  });

  describe('load<%= className %>$', () => {
    it('should work', () => {
      actions = hot('-a-|', {a: new Load<%= className %>()});
      expect(effects.load<%= className %>$).toBeObservable(
        hot('-a-|', {a: new <%= className %>Loaded([])})
      );
    });
  });
});
