huridocs/uwazi

View on GitHub
app/react/Map/specs/__snapshots__/helper.spec.js.snap

Summary

Maintainability
Test Coverage
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`map helper getMarkers() Inheritance should include inherited properties 1`] = `
Array [
  Object {
    "label": "Inherited Property Label 1",
    "latitude": 23,
    "longitude": 1946,
    "properties": Object {
      "color": "red",
      "context": "t2",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
      "inherited": true,
      "label": "e5 Label",
    },
  },
  Object {
    "label": "Inherited Property Label 1",
    "latitude": 2018,
    "longitude": 6,
    "properties": Object {
      "color": "red",
      "context": "t2",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
      "inherited": true,
      "label": "e4 Label",
    },
  },
  Object {
    "label": "Inherited Property Label 1",
    "latitude": 1977,
    "longitude": 1982,
    "properties": Object {
      "color": "red",
      "context": "t2",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": "inherited label",
      "inherited": true,
      "label": "e4 Label",
    },
  },
  Object {
    "label": "Inherited Property Label 2",
    "latitude": 23,
    "longitude": 1946,
    "properties": Object {
      "color": "red",
      "context": "t4",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
      "inherited": true,
      "label": "e5 Label",
    },
  },
  Object {
    "label": "geoPropertyLabel",
    "latitude": 7,
    "longitude": 13,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "geoPropertyLabel",
    "latitude": 13,
    "longitude": 7,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": "home",
    },
  },
  Object {
    "label": "secondGeoPropertyLabel",
    "latitude": 5,
    "longitude": 13,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "inheritedGeo1": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 2018,
                    "lon": 6,
                  },
                },
                Object {
                  "value": Object {
                    "label": "inherited label",
                    "lat": 1977,
                    "lon": 1982,
                  },
                },
              ],
              "label": "e4 Label",
              "value": "e4",
            },
          ],
          "inheritedGeo2": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "lat": 23,
                    "lon": 1946,
                  },
                },
              ],
              "label": "e5 Label",
              "value": "e5",
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "geoPropertyLabel",
    "latitude": 5,
    "longitude": 22,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 22,
              },
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": null,
            },
          ],
        },
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "anotherGeoPropertyLabel",
    "latitude": 2018,
    "longitude": 6,
    "properties": Object {
      "color": "blue",
      "entity": Object {
        "metadata": Object {
          "anotherGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 2018,
                "lon": 6,
              },
            },
          ],
        },
        "sharedId": "e4",
        "template": "t2",
        "title": "e4Title",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "anotherGeoPropertyLabel",
    "latitude": 23,
    "longitude": 1946,
    "properties": Object {
      "color": "blue",
      "entity": Object {
        "metadata": Object {
          "anotherGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 23,
                "lon": 1946,
              },
            },
          ],
        },
        "sharedId": "e5",
        "template": "t2",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "Another Inherited Property Label",
    "latitude": 13,
    "longitude": 7,
    "properties": Object {
      "color": "yellow",
      "context": "t1",
      "entity": Object {
        "metadata": Object {
          "anotherInheritedGeo": Array [
            Object {
              "inherit_geolocation": Array [
                Object {
                  "value": Object {
                    "label": "home",
                    "lat": 13,
                    "lon": 7,
                  },
                },
              ],
              "label": "e1 Label",
              "value": "e1",
            },
          ],
        },
        "template": "t4",
      },
      "info": "home",
      "inherited": true,
      "label": "e1 Label",
    },
  },
]
`;

exports[`map helper getMarkers() should calculate the entity markers based on template data 1`] = `
Array [
  Object {
    "label": "geoPropertyLabel",
    "latitude": 7,
    "longitude": 13,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "geoPropertyLabel",
    "latitude": 13,
    "longitude": 7,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": "home",
    },
  },
  Object {
    "label": "secondGeoPropertyLabel",
    "latitude": 5,
    "longitude": 13,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 7,
                "lon": 13,
              },
            },
            Object {
              "value": Object {
                "label": "home",
                "lat": 13,
                "lon": 7,
              },
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 13,
              },
            },
          ],
          "text": Array [
            Object {
              "value": "text value",
            },
          ],
        },
        "sharedId": "e1",
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "geoPropertyLabel",
    "latitude": 5,
    "longitude": 22,
    "properties": Object {
      "color": "red",
      "entity": Object {
        "metadata": Object {
          "geoProperty": Array [
            Object {
              "value": Object {
                "lat": 5,
                "lon": 22,
              },
            },
          ],
          "secondGeoProperty": Array [
            Object {
              "value": null,
            },
          ],
        },
        "template": "t1",
      },
      "info": undefined,
    },
  },
  Object {
    "label": "anotherGeoPropertyLabel",
    "latitude": 2018,
    "longitude": 6,
    "properties": Object {
      "color": "blue",
      "entity": Object {
        "metadata": Object {
          "anotherGeoProperty": Array [
            Object {
              "value": Object {
                "lat": 2018,
                "lon": 6,
              },
            },
          ],
        },
        "sharedId": "e4",
        "template": "t2",
        "title": "e4Title",
      },
      "info": undefined,
    },
  },
]
`;