|
|
@ -1,6 +1,10 @@ |
|
|
|
import t from 'tap'; |
|
|
|
import t from 'tap'; |
|
|
|
import { Marker, ReducerAction } from './types'; |
|
|
|
import { Marker } from './types'; |
|
|
|
import { createChangeStateMethods, markersReducer } from './useMarkers.js'; |
|
|
|
import { |
|
|
|
|
|
|
|
ReducerAction, |
|
|
|
|
|
|
|
createChangeStateMethods, |
|
|
|
|
|
|
|
markersReducer, |
|
|
|
|
|
|
|
} from './useMarkers.js'; |
|
|
|
|
|
|
|
|
|
|
|
// Testing entire `useMarkers` custom hook would require us to create test preact components here
|
|
|
|
// Testing entire `useMarkers` custom hook would require us to create test preact components here
|
|
|
|
// and render them into virtual DOM and check the results, which is just too much hassle
|
|
|
|
// and render them into virtual DOM and check the results, which is just too much hassle
|
|
|
@ -38,9 +42,11 @@ const createReducersWithFivePoints = () => { |
|
|
|
|
|
|
|
|
|
|
|
const markerPattern = { |
|
|
|
const markerPattern = { |
|
|
|
key: String, |
|
|
|
key: String, |
|
|
|
|
|
|
|
longLabel: String, |
|
|
|
moveUp: Function, |
|
|
|
moveUp: Function, |
|
|
|
moveDown: Function, |
|
|
|
moveDown: Function, |
|
|
|
remove: Function, |
|
|
|
remove: Function, |
|
|
|
|
|
|
|
changeLongLabel: Function, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
void t.test('reducer', (t) => { |
|
|
|
void t.test('reducer', (t) => { |
|
|
@ -58,11 +64,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
void t.test('create markers with correct labels', (t) => { |
|
|
|
void t.test('create markers with correct labels', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -71,10 +77,10 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[0]?.remove(); |
|
|
|
reducers.getMarkers()[0]?.remove(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -83,10 +89,10 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[2]?.remove(); |
|
|
|
reducers.getMarkers()[2]?.remove(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -95,10 +101,10 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[4]?.remove(); |
|
|
|
reducers.getMarkers()[4]?.remove(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -107,11 +113,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[0]?.moveUp(); |
|
|
|
reducers.getMarkers()[0]?.moveUp(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -120,11 +126,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[0]?.moveDown(); |
|
|
|
reducers.getMarkers()[0]?.moveDown(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -133,11 +139,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[1]?.moveUp(); |
|
|
|
reducers.getMarkers()[1]?.moveUp(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -146,11 +152,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[1]?.moveDown(); |
|
|
|
reducers.getMarkers()[1]?.moveDown(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -159,11 +165,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[2]?.moveUp(); |
|
|
|
reducers.getMarkers()[2]?.moveUp(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -172,11 +178,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[2]?.moveDown(); |
|
|
|
reducers.getMarkers()[2]?.moveDown(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -185,11 +191,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[3]?.moveUp(); |
|
|
|
reducers.getMarkers()[3]?.moveUp(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -198,11 +204,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[3]?.moveDown(); |
|
|
|
reducers.getMarkers()[3]?.moveDown(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates4 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -211,11 +217,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[4]?.moveUp(); |
|
|
|
reducers.getMarkers()[4]?.moveUp(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates4 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -224,11 +230,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.getMarkers()[4]?.moveDown(); |
|
|
|
reducers.getMarkers()[4]?.moveDown(); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -237,11 +243,11 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.reorderMarkers({ oldIndex: 1, newIndex: 3 }); |
|
|
|
reducers.reorderMarkers({ oldIndex: 1, newIndex: 3 }); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -250,11 +256,29 @@ void t.test('reducer methods', (t) => { |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
reducers.reorderMarkers({ oldIndex: 3, newIndex: 1 }); |
|
|
|
reducers.reorderMarkers({ oldIndex: 3, newIndex: 1 }); |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
{ ...markerPattern, label: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
{ ...markerPattern, label: '2', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates4 }, |
|
|
|
{ ...markerPattern, label: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, shortLabel: '3', coordinates: coordinates2 }, |
|
|
|
{ ...markerPattern, label: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates3 }, |
|
|
|
{ ...markerPattern, label: '5', coordinates: coordinates5 }, |
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
t.end(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void t.test('renames marker', (t) => { |
|
|
|
|
|
|
|
const reducers = createReducersWithFivePoints(); |
|
|
|
|
|
|
|
reducers.getMarkers()[2]?.changeLongLabel('new label'); |
|
|
|
|
|
|
|
t.matchOnlyStrict(reducers.getMarkers(), [ |
|
|
|
|
|
|
|
{ ...markerPattern, shortLabel: '1', coordinates: coordinates1 }, |
|
|
|
|
|
|
|
{ ...markerPattern, shortLabel: '2', coordinates: coordinates2 }, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
...markerPattern, |
|
|
|
|
|
|
|
shortLabel: '3', |
|
|
|
|
|
|
|
coordinates: coordinates3, |
|
|
|
|
|
|
|
longLabel: 'new label', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ ...markerPattern, shortLabel: '4', coordinates: coordinates4 }, |
|
|
|
|
|
|
|
{ ...markerPattern, shortLabel: '5', coordinates: coordinates5 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
t.end(); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|