<commit_before>import { async, inject, TestBed } from '@angular/core/testing';
import { Store, StoreModule } from '@ngrx/store';
import { provideMockActions } from '@ngrx/effects/testing';
import { Observable } from 'rxjs/Observable';
import { SelectCaseAppEffects } from '@ansyn/ansyn/app-effects/effects/cases/select-case.app.effects';
import {
	Case, CaseGeoFilter, CaseLayersState, CaseMapsState, CaseOrientation, CaseRegionState, CaseState, CaseTimeFilter,
	CaseTimeState, SetLayoutAction, SetOverlaysCriteriaAction
} from '@ansyn/core';
import { CasesService, SelectCaseAction } from '@ansyn/menu-items';
import { cold, hot } from 'jasmine-marbles';
import { SetAnnotationsLayer, ToggleDisplayAnnotationsLayer } from '@ansyn/menu-items/layers-manager/actions/layers.actions';
import { SetComboBoxesProperties } from '@ansyn/status-bar';
import { SetMapsDataActionStore } from '@ansyn/map-facade/actions/map.actions';
import { SetFavoriteOverlaysAction } from '@ansyn/core/actions/core.actions';
import { Overlay } from '@ansyn/core/models/overlay.model';
import { HttpClientModule } from '@angular/common/http';
import { OverlaysService } from '@ansyn/overlays';

describe('SelectCaseAppEffects', () => {
	let selectCaseAppEffects: SelectCaseAppEffects;
	let actions: Observable<any>;
	let store: Store<any>;
	let mockCasesService = {
		contextValues: {
			imageryCountBefore: -1,
			imageryCountAfter: -1
		}
	};
	let mockOverlaysService = {
		getStartDateViaLimitFacets: () => Observable.of({startDate: new Date(), endDate: new Date()}),
		getStartAndEndDateViaRangeFacets: () => Observable.of({startDate: new Date(), endDate: new Date()})
	};

	beforeEach(async(() => {
		TestBed.configureTestingModule({
			imports: [
				StoreModule.forRoot({}),
				HttpClientModule
			],
			providers: [
				SelectCaseAppEffects,
				{
					provide: CasesService,
					useValue: mockCasesService
				},
				{
					provide: OverlaysService,
					useValue: mockOverlaysService
				},
				provideMockActions(() => actions)
			]
		}).compileComponents();
	}));

	beforeEach(inject([Store], (_store: Store<any>) => {
		store = _store;
	}));

	beforeEach(inject([SelectCaseAppEffects], (_selectCaseAppEffects: SelectCaseAppEffects) => {
		selectCaseAppEffects = _selectCaseAppEffects;
	}));

	it('should be defined', () => {
		expect(selectCaseAppEffects).toBeDefined();
	});

	describe('selectCase$', () => {
		it('should set all feature stores properties', () => {
			const
				orientation: CaseOrientation = 'Imagery Perspective',
				geoFilter: CaseGeoFilter = 'Pin-Point',
				timeFilter: CaseTimeFilter = 'Start - End',
				time: CaseTimeState = { type: 'absolute', from: new Date(0), to: new Date(0) },
				region: CaseRegionState = {},
				favoriteOverlays: Overlay[] = [],
				maps: CaseMapsState = { activeMapId: 'activeMapId', data: [], layout: 'layout6' },
				layers: CaseLayersState = { displayAnnotationsLayer: false, annotationsLayer: <any> {} };

			const state: CaseState = <any> { orientation, geoFilter, timeFilter, time, region, favoriteOverlays, maps, layers };

			const payload: Case = {
				id: 'caseId',
				name: 'caseName',
				lastModified: new Date(),
				state
			};

			actions = hot('--a--', { a: new SelectCaseAction(payload) });

			const expectedResult = cold('--(abcdefg)--', {
				a: new SetLayoutAction(maps.layout),
				b: new SetComboBoxesProperties({ orientation, geoFilter, timeFilter }),
				c: new SetOverlaysCriteriaAction({ time, region }),
				d: new SetMapsDataActionStore({ mapsList: maps.data, activeMapId: maps.activeMapId }),
				e: new SetFavoriteOverlaysAction(favoriteOverlays),
				f: new SetAnnotationsLayer(layers.annotationsLayer),
				g: new ToggleDisplayAnnotationsLayer(layers.displayAnnotationsLayer),
			});

			expect(selectCaseAppEffects.selectCase$).toBeObservable(expectedResult)
		});
	});
});<commit_msg>cases: owner and creationTime are mandatory fields<commit_after>import { async, inject, TestBed } from '@angular/core/testing';
import { Store, StoreModule } from '@ngrx/store';
import { provideMockActions } from '@ngrx/effects/testing';
import { Observable } from 'rxjs/Observable';
import { SelectCaseAppEffects } from '@ansyn/ansyn/app-effects/effects/cases/select-case.app.effects';
import {
	Case, CaseGeoFilter, CaseLayersState, CaseMapsState, CaseOrientation, CaseRegionState, CaseState, CaseTimeFilter,
	CaseTimeState, SetLayoutAction, SetOverlaysCriteriaAction
} from '@ansyn/core';
import { CasesService, SelectCaseAction } from '@ansyn/menu-items';
import { cold, hot } from 'jasmine-marbles';
import { SetAnnotationsLayer, ToggleDisplayAnnotationsLayer } from '@ansyn/menu-items/layers-manager/actions/layers.actions';
import { SetComboBoxesProperties } from '@ansyn/status-bar';
import { SetMapsDataActionStore } from '@ansyn/map-facade/actions/map.actions';
import { SetFavoriteOverlaysAction } from '@ansyn/core/actions/core.actions';
import { Overlay } from '@ansyn/core/models/overlay.model';
import { HttpClientModule } from '@angular/common/http';
import { OverlaysService } from '@ansyn/overlays';

describe('SelectCaseAppEffects', () => {
	let selectCaseAppEffects: SelectCaseAppEffects;
	let actions: Observable<any>;
	let store: Store<any>;
	let mockCasesService = {
		contextValues: {
			imageryCountBefore: -1,
			imageryCountAfter: -1
		}
	};
	let mockOverlaysService = {
		getStartDateViaLimitFacets: () => Observable.of({startDate: new Date(), endDate: new Date()}),
		getStartAndEndDateViaRangeFacets: () => Observable.of({startDate: new Date(), endDate: new Date()})
	};

	beforeEach(async(() => {
		TestBed.configureTestingModule({
			imports: [
				StoreModule.forRoot({}),
				HttpClientModule
			],
			providers: [
				SelectCaseAppEffects,
				{
					provide: CasesService,
					useValue: mockCasesService
				},
				{
					provide: OverlaysService,
					useValue: mockOverlaysService
				},
				provideMockActions(() => actions)
			]
		}).compileComponents();
	}));

	beforeEach(inject([Store], (_store: Store<any>) => {
		store = _store;
	}));

	beforeEach(inject([SelectCaseAppEffects], (_selectCaseAppEffects: SelectCaseAppEffects) => {
		selectCaseAppEffects = _selectCaseAppEffects;
	}));

	it('should be defined', () => {
		expect(selectCaseAppEffects).toBeDefined();
	});

	describe('selectCase$', () => {
		it('should set all feature stores properties', () => {
			const
				orientation: CaseOrientation = 'Imagery Perspective',
				geoFilter: CaseGeoFilter = 'Pin-Point',
				timeFilter: CaseTimeFilter = 'Start - End',
				time: CaseTimeState = { type: 'absolute', from: new Date(0), to: new Date(0) },
				region: CaseRegionState = {},
				favoriteOverlays: Overlay[] = [],
				maps: CaseMapsState = { activeMapId: 'activeMapId', data: [], layout: 'layout6' },
				layers: CaseLayersState = { displayAnnotationsLayer: false, annotationsLayer: <any> {} };

			const state: CaseState = <any> { orientation, geoFilter, timeFilter, time, region, favoriteOverlays, maps, layers };

			const payload: Case = {
				id: 'caseId',
				name: 'caseName',
				owner: 'ownerName',
				lastModified: new Date(),
				creationTime: new Date(),
				state
			};

			actions = hot('--a--', { a: new SelectCaseAction(payload) });

			const expectedResult = cold('--(abcdefg)--', {
				a: new SetLayoutAction(maps.layout),
				b: new SetComboBoxesProperties({ orientation, geoFilter, timeFilter }),
				c: new SetOverlaysCriteriaAction({ time, region }),
				d: new SetMapsDataActionStore({ mapsList: maps.data, activeMapId: maps.activeMapId }),
				e: new SetFavoriteOverlaysAction(favoriteOverlays),
				f: new SetAnnotationsLayer(layers.annotationsLayer),
				g: new ToggleDisplayAnnotationsLayer(layers.displayAnnotationsLayer),
			});

			expect(selectCaseAppEffects.selectCase$).toBeObservable(expectedResult)
		});
	});
});
{'fraction_non_alphanumeric': 0.13975194987853215, 'fraction_numerical': 0.0012786088735455823, 'mean_word_length': 4.9167927382753405, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, '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': '6002844', 'n_tokens_mistral': 2712, 'n_tokens_neox': 2378, 'n_words': 509}