Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeininger committed Dec 1, 2023
1 parent ddc17fa commit 6179f63
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 13 deletions.
96 changes: 96 additions & 0 deletions test/js/component/menu/__snapshots__/menu.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ exports[`menu component > should render menu 1`] = `
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_real_estate
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_background_map
</span>
</button>
</li>
</ul>
<button
aria-expanded="false"
Expand Down Expand Up @@ -178,6 +202,30 @@ exports[`search > should show GNSS coordinates 1`] = `
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_real_estate
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_background_map
</span>
</button>
</li>
</ul>
<button
aria-expanded="false"
Expand Down Expand Up @@ -286,6 +334,30 @@ exports[`search > should show LV95 coordinates 1`] = `
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_real_estate
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_background_map
</span>
</button>
</li>
</ul>
<button
aria-expanded="false"
Expand Down Expand Up @@ -416,6 +488,30 @@ exports[`search > should show results 1`] = `
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_real_estate
</span>
</button>
</li>
<li>
<button
class="dropdown-item"
>
<span>
<i
class="bi bi-check-square"
/>
menu.settings.show_background_map
</span>
</button>
</li>
</ul>
<button
aria-expanded="false"
Expand Down
114 changes: 104 additions & 10 deletions test/js/reducer/extract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import reducer, {
setInformationPanelTab,
showError,
showExtract,
toggleBackground,
toggleCollapsed,
toggleHighlight,
toggleInformationPanel} from '../../../oereb_client/static/src/reducer/extract';

describe('extract reducer', () => {
Expand All @@ -21,7 +23,9 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
});

Expand All @@ -45,7 +49,9 @@ describe('extract reducer', () => {
number: '1234',
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
expect(window.history.pushState).toHaveBeenCalled();
});
Expand Down Expand Up @@ -74,7 +80,9 @@ describe('extract reducer', () => {
tab: 0,
data: {
foo: 'bar'
}
},
highlight: true,
background: true
});
});

Expand All @@ -101,7 +109,9 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
});

Expand All @@ -127,7 +137,9 @@ describe('extract reducer', () => {
number: '1234',
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
expect(window.history.pushState).toHaveBeenCalled();
});
Expand All @@ -146,7 +158,9 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
state = reducer(state, toggleCollapsed());
expect(state).toEqual({
Expand All @@ -160,7 +174,9 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
});

Expand All @@ -179,7 +195,9 @@ describe('extract reducer', () => {
number: null,
information: true,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
state = reducer(state, toggleInformationPanel());
expect(state).toEqual({
Expand All @@ -193,7 +211,81 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 0,
data: {}
data: {},
highlight: true,
background: true
});
});

it('should toggle real estate highlight', () => {
let state = reducer(undefined, {});
state = reducer(state, toggleHighlight());
expect(state).toEqual({
loading: false,
zoom: false,
visible: false,
collapsed: false,
error: false,
egrid: null,
identdn: null,
number: null,
information: false,
tab: 0,
data: {},
highlight: false,
background: true
});
state = reducer(state, toggleHighlight());
expect(state).toEqual({
loading: false,
zoom: false,
visible: false,
collapsed: false,
error: false,
egrid: null,
identdn: null,
number: null,
information: false,
tab: 0,
data: {},
highlight: true,
background: true
});
});

it('should toggle background map', () => {
let state = reducer(undefined, {});
state = reducer(state, toggleBackground());
expect(state).toEqual({
loading: false,
zoom: false,
visible: false,
collapsed: false,
error: false,
egrid: null,
identdn: null,
number: null,
information: false,
tab: 0,
data: {},
highlight: true,
background: false
});
state = reducer(state, toggleBackground());
expect(state).toEqual({
loading: false,
zoom: false,
visible: false,
collapsed: false,
error: false,
egrid: null,
identdn: null,
number: null,
information: false,
tab: 0,
data: {},
highlight: true,
background: true
});
});

Expand All @@ -211,7 +303,9 @@ describe('extract reducer', () => {
number: null,
information: false,
tab: 1,
data: {}
data: {},
highlight: true,
background: true
});
});

Expand Down
9 changes: 6 additions & 3 deletions test/js/reducer/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ describe('map reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual({
map: null,
topicLayers: null
topicLayers: null,
baseLayer: null
});
});

it('should init map', () => {
let state = reducer(undefined, {});
state = reducer(state, initMap({
map: 'foo',
topicLayers: 'bar'
topicLayers: 'bar',
baseLayer: 'baz'
}));
expect(state).toEqual({
map: 'foo',
topicLayers: 'bar'
topicLayers: 'bar',
baseLayer: 'baz'
});
});

Expand Down

0 comments on commit 6179f63

Please sign in to comment.