()
| 254 | |
| 255 | // Tests for labels() function |
| 256 | function setupMultiLabelGraph(): Graph<GraphSchema> { |
| 257 | const schema = { |
| 258 | vertices: { |
| 259 | User: { |
| 260 | properties: { |
| 261 | name: { type: makeType<string>("") }, |
| 262 | }, |
| 263 | }, |
| 264 | Post: { |
| 265 | properties: { |
| 266 | title: { type: makeType<string>("") }, |
| 267 | }, |
| 268 | }, |
| 269 | Comment: { |
| 270 | properties: { |
| 271 | text: { type: makeType<string>("") }, |
| 272 | }, |
| 273 | }, |
| 274 | }, |
| 275 | edges: { |
| 276 | wrote: { |
| 277 | properties: {}, |
| 278 | }, |
| 279 | }, |
| 280 | } as const satisfies GraphSchema; |
| 281 | |
| 282 | const graph = new Graph({ schema, storage: new InMemoryGraphStorage() }); |
| 283 | |
| 284 | // Add vertices with different labels |
| 285 | const alice = graph.addVertex("User", { name: "Alice" }); |
| 286 | const bob = graph.addVertex("User", { name: "Bob" }); |
| 287 | const post1 = graph.addVertex("Post", { title: "Hello World" }); |
| 288 | const post2 = graph.addVertex("Post", { title: "Second Post" }); |
| 289 | const comment1 = graph.addVertex("Comment", { text: "Nice post!" }); |
| 290 | |
| 291 | graph.addEdge(alice.id, "wrote", post1.id, {}); |
| 292 | graph.addEdge(bob.id, "wrote", post2.id, {}); |
| 293 | graph.addEdge(alice.id, "wrote", comment1.id, {}); |
| 294 | |
| 295 | return graph; |
| 296 | } |
| 297 | |
| 298 | test("Query Execution End-to-End - labels() function - should return labels for a single vertex", () => { |
| 299 | const graph = setupMultiLabelGraph(); |
no test coverage detected