|
| 1 | +import { allPlacesWithAggregatedAttributes } from "../../__data__/allPlacesWithAggregatedAttributes" |
1 | 2 | import { hotSceneGenesisPlaza } from "../../__data__/hotSceneGenesisPlaza"
|
2 | 3 | import { placeGenesisPlazaWithAggregatedAttributes } from "../../__data__/placeGenesisPlazaWithAggregatedAttributes"
|
3 | 4 | import { sceneStatsGenesisPlaza } from "../../__data__/sceneStatsGenesisPlaza"
|
4 |
| -import { placesWithCoordinatesAggregates } from "./utils" |
| 5 | +import { worldsLiveData } from "../../__data__/worldsLiveData" |
| 6 | +import { |
| 7 | + allPlacesWithAggregates, |
| 8 | + placesWithCoordinatesAggregates, |
| 9 | +} from "./utils" |
5 | 10 |
|
6 | 11 | describe("get of AggregatePlaceAttributes", () => {
|
7 | 12 | test("should return a place of type AggregateCoordinatePlaceAttributes", () => {
|
@@ -67,3 +72,80 @@ describe("get of AggregatePlaceAttributes", () => {
|
67 | 72 | })
|
68 | 73 | })
|
69 | 74 | })
|
| 75 | + |
| 76 | +describe("get of AllPlacesWithAggregates", () => { |
| 77 | + test("should return a place of type AggregateCoordinatePlaceAttributes", () => { |
| 78 | + const places = allPlacesWithAggregates( |
| 79 | + allPlacesWithAggregatedAttributes, |
| 80 | + [hotSceneGenesisPlaza], |
| 81 | + sceneStatsGenesisPlaza, |
| 82 | + worldsLiveData |
| 83 | + ) |
| 84 | + expect(places).toEqual([ |
| 85 | + { |
| 86 | + ...allPlacesWithAggregatedAttributes[0], |
| 87 | + user_count: hotSceneGenesisPlaza.usersTotalCount, |
| 88 | + user_visits: |
| 89 | + sceneStatsGenesisPlaza[ |
| 90 | + allPlacesWithAggregatedAttributes[0].base_position |
| 91 | + ].last_30d.users, |
| 92 | + }, |
| 93 | + { |
| 94 | + ...allPlacesWithAggregatedAttributes[1], |
| 95 | + user_count: worldsLiveData.perWorld[0].users, |
| 96 | + // TODO: Get user visits from world stats |
| 97 | + user_visits: 0, |
| 98 | + }, |
| 99 | + ]) |
| 100 | + }) |
| 101 | + |
| 102 | + test("should return a place of type AggregatePlaceAttributes with user_visits when not match the base position", () => { |
| 103 | + const place = { |
| 104 | + ...allPlacesWithAggregatedAttributes[0], |
| 105 | + base_position: "-1,-1", |
| 106 | + } |
| 107 | + const places = allPlacesWithAggregates( |
| 108 | + [place], |
| 109 | + [hotSceneGenesisPlaza], |
| 110 | + sceneStatsGenesisPlaza, |
| 111 | + worldsLiveData |
| 112 | + ) |
| 113 | + expect(places).toEqual([ |
| 114 | + { |
| 115 | + ...place, |
| 116 | + user_count: hotSceneGenesisPlaza.usersTotalCount, |
| 117 | + user_visits: |
| 118 | + sceneStatsGenesisPlaza[ |
| 119 | + allPlacesWithAggregatedAttributes[0].base_position |
| 120 | + ].last_30d.users, |
| 121 | + }, |
| 122 | + ]) |
| 123 | + }) |
| 124 | + |
| 125 | + test("should return a place of type AggregatePlaceAttributes with realm details", () => { |
| 126 | + const places = allPlacesWithAggregates( |
| 127 | + allPlacesWithAggregatedAttributes, |
| 128 | + [hotSceneGenesisPlaza], |
| 129 | + sceneStatsGenesisPlaza, |
| 130 | + worldsLiveData, |
| 131 | + { withRealmsDetail: true } |
| 132 | + ) |
| 133 | + expect(places).toEqual([ |
| 134 | + { |
| 135 | + ...allPlacesWithAggregatedAttributes[0], |
| 136 | + user_count: hotSceneGenesisPlaza.usersTotalCount, |
| 137 | + user_visits: |
| 138 | + sceneStatsGenesisPlaza[ |
| 139 | + allPlacesWithAggregatedAttributes[0].base_position |
| 140 | + ].last_30d.users, |
| 141 | + realms_detail: hotSceneGenesisPlaza.realms, |
| 142 | + }, |
| 143 | + { |
| 144 | + ...allPlacesWithAggregatedAttributes[1], |
| 145 | + user_count: worldsLiveData.perWorld[0].users, |
| 146 | + // TODO: Get user visits from world stats |
| 147 | + user_visits: 0, |
| 148 | + }, |
| 149 | + ]) |
| 150 | + }) |
| 151 | +}) |
0 commit comments