This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create CONTRIBUTING.md * Update README.md * Update CONTRIBUTING.md * Fix overflow * Publish package to NPM * Fix for CI and publish * Remove Redux (#71) * package bump * remove redux packages * remove redux logic * remove actions, reducers and store * update spec imports * Trigger github action on both push and PR * Test with jest (#73) * package bump * remove redux packages * remove redux logic * remove actions, reducers and store * update spec imports * replace enzyme with jest * delete old specs and restructure code * add test structure * zero binds for local functions * refactor and debug tests * act on clicks * delete old layers folder * delete old layer spec * rewrite sidebaar to functional component * rewrite App as a functional component * Remove nodejs 8 from CI workflow * move seed data to consts * rewrite sidebar as fucntional component * rewrite menu as functional component * ref to loaded driver * rewrite map component as function * review map and add test data * sequence full map operations * mock out leaflet * usable test data, pause ut on map * rewrite color picker as functional component * singleton neo4j driver and service * formalise error and result api on neo4jservice * use error and result apiin layer ui * fix map reinstantiation error * format leaflet mock * fix result filters * optimise create driver * dry session runner * scaffold neo4j service tests * tests and service refactors * fix token fetch for driver init * fix records query * Fix several bugs (#88) * Make the app work again... * Enhanced master fix (#89) * enhanced master fix * map and layer pane fixes * update layer tests * class => className * Do not force name (for now) Co-authored-by: Konuko Jodom <[email protected]> * Several fixes, including #81 and #82 * Fix tests (?) * re-generate lock file Co-authored-by: Konuko Jodom <[email protected]> Co-authored-by: nikita <[email protected]>
- Loading branch information
1 parent
b6471c5
commit 1138e4e
Showing
36 changed files
with
5,244 additions
and
5,808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
registry=https://neo.jfrog.io/neo/api/npm/npm/ | ||
registry=https://neo.jfrog.io/neo/api/npm/npm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Contribution guide (WIP) | ||
|
||
All contributions are currently welcome. Some tasks that are in our priority list right now include: | ||
- Code review and improvements using latest React release and standard (hooks) https://github.com/stellasia/neomap/issues/55 | ||
- Write real covering tests https://github.com/stellasia/neomap/issues/62 | ||
- Map: feature request: https://github.com/stellasia/neomap/issues/51 | ||
- UI needs to be checked by someone with more experience in UI/UX | ||
|
||
## Issue contribution | ||
|
||
Open an issue if: | ||
- You encounter problems installing or using neomap | ||
- You find something that looks like a bug (even if you are unsure) | ||
- You would like us to include a new feature | ||
|
||
|
||
## Documentation contribution | ||
|
||
Right now the documentation is hosted on GitHub wiki: https://github.com/stellasia/neomap/wiki. Contact me if you would like to help improving it. | ||
|
||
|
||
## Code contribution | ||
|
||
1. Let the others know you are working on the topic: | ||
- comment on an existing issue or | ||
- create a new issue if the topic is new. It will also allow us to make sure we are all aligned with the direction we want to push the project to. | ||
2. Clone the repo and start a new branch on your local clone | ||
3. Develop on your branch | ||
4. Make sure you are not breaking tests and potentially add new ones (ok, given the state of the tests right now, this is not a big constraint) | ||
5. Open a PR againt the dev branch referencing the issue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/** | ||
* This is a copy of the very nice jest leaflet mock from | ||
* [react-leaflet](https://github.com/PaulLeCam/react-leaflet/blob/master/__mocks__/leaflet.js). | ||
* | ||
* Consider contributing back to the package :) | ||
*/ | ||
|
||
import { L } from 'leaflet'; | ||
const LeafletMock = jest.createMockFromModule('leaflet') | ||
|
||
class ControlMock extends LeafletMock.Control { | ||
constructor(options) { | ||
super() | ||
this.options = { ...L.Control.prototype.options, ...options } | ||
} | ||
|
||
getPosition() { | ||
return this.options.position | ||
} | ||
|
||
setPosition(position) { | ||
this.options.position = position | ||
return this | ||
} | ||
} | ||
|
||
const controlMock = (options) => new ControlMock(options) | ||
|
||
class LayersControlMock extends ControlMock { | ||
constructor(baseLayers = [], overlays = [], options) { | ||
super(options) | ||
this._layers = [] | ||
|
||
baseLayers.forEach((layer, i) => { | ||
this._addLayer(layer, i) | ||
}) | ||
overlays.forEach((layer, i) => { | ||
this._addLayer(layer, i, true) | ||
}) | ||
} | ||
|
||
_addLayer(layer, name, overlay) { | ||
this._layers.push({ layer, name, overlay }) | ||
} | ||
|
||
addBaseLayer(layer, name) { | ||
this._addLayer(layer, name) | ||
return this | ||
} | ||
|
||
addOverlay(layer, name) { | ||
this._addLayer(layer, name, true) | ||
return this | ||
} | ||
|
||
removeLayer(obj) { | ||
this._layers.splice(this._layers.indexOf(obj), 1) | ||
} | ||
} | ||
|
||
ControlMock.Layers = LayersControlMock | ||
controlMock.layers = (baseLayers, overlays, options) => { | ||
return new LayersControlMock(baseLayers, overlays, options) | ||
} | ||
|
||
class MapMock extends LeafletMock.Map { | ||
constructor(id, options = {}) { | ||
super() | ||
Object.assign(this, L.Evented.prototype) | ||
|
||
this.options = { ...L.Map.prototype.options, ...options } | ||
this._container = id | ||
|
||
if (options.bounds) { | ||
this.fitBounds(options.bounds, options.boundsOptions) | ||
} | ||
|
||
if (options.maxBounds) { | ||
this.setMaxBounds(options.maxBounds) | ||
} | ||
|
||
if (options.center && options.zoom !== undefined) { | ||
this.setView(L.latLng(options.center), options.zoom) | ||
} | ||
} | ||
|
||
_limitZoom(zoom) { | ||
const min = this.getMinZoom() | ||
const max = this.getMaxZoom() | ||
return Math.max(min, Math.min(max, zoom)) | ||
} | ||
|
||
_resetView(center, zoom) { | ||
this._initialCenter = center | ||
this._zoom = zoom | ||
} | ||
|
||
fitBounds(bounds, options) { | ||
this._bounds = bounds | ||
this._boundsOptions = options | ||
} | ||
|
||
getBounds() { | ||
return this._bounds | ||
} | ||
|
||
getCenter() { | ||
return this._initialCenter | ||
} | ||
|
||
getMaxZoom() { | ||
return this.options.maxZoom === undefined ? Infinity : this.options.maxZoom | ||
} | ||
|
||
getMinZoom() { | ||
return this.options.minZoom === undefined ? 0 : this.options.minZoom | ||
} | ||
|
||
getZoom() { | ||
return this._zoom | ||
} | ||
|
||
setMaxBounds(bounds) { | ||
bounds = L.latLngBounds(bounds) | ||
this.options.maxBounds = bounds | ||
return this | ||
} | ||
|
||
setView(center, zoom) { | ||
zoom = zoom === undefined ? this.getZoom() : zoom | ||
this._resetView(L.latLng(center), this._limitZoom(zoom)) | ||
return this | ||
} | ||
|
||
setZoom(zoom) { | ||
return this.setView(this.getCenter(), zoom) | ||
} | ||
} | ||
|
||
class PopupMock extends LeafletMock.Popup { | ||
constructor(options, source) { | ||
super() | ||
Object.assign(this, L.Evented.prototype) | ||
|
||
this.options = { ...L.Popup.prototype.options, ...options } | ||
this._source = source | ||
} | ||
|
||
getContent() { | ||
return this._content | ||
} | ||
|
||
setContent(content) { | ||
this._content = content | ||
} | ||
} | ||
|
||
module.exports = { | ||
...LeafletMock, | ||
Control: ControlMock, | ||
control: controlMock, | ||
LatLng: L.LatLng, | ||
latLng: L.latLng, | ||
LatLngBounds: L.LatLngBounds, | ||
latLngBounds: L.latLngBounds, | ||
Map: MapMock, | ||
map: (id, options) => new MapMock(id, options), | ||
Popup: PopupMock, | ||
popup: (options, source) => new PopupMock(options, source), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Object.defineProperty(window, 'neo4jDesktopApi', { | ||
writable: true, | ||
value: { | ||
getContext: jest.fn().mockImplementation(() => { | ||
const mockGraph = { | ||
name: 'mock graph', | ||
description: 'mock graph for testing', | ||
status: 'ACTIVE', | ||
connection: { | ||
configuration: { | ||
protocols: { | ||
bolt: { | ||
url: '', | ||
username: '', | ||
password: '' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
const mockProject = { | ||
graphs: [mockGraph] | ||
} | ||
|
||
const mockContext = { | ||
projects: [mockProject] | ||
} | ||
|
||
return Promise.resolve(mockContext); | ||
}) | ||
} | ||
}); |
Oops, something went wrong.