mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
24 lines
548 B
TypeScript
24 lines
548 B
TypeScript
import { Bound } from '@blocksuite/global/utils';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import { Graph } from '../utils/graph.js';
|
|
|
|
describe('graph', () => {
|
|
it('neighbors', () => {
|
|
const bound = new Bound(-5, 5, 10, 10);
|
|
const graph = new Graph(
|
|
[
|
|
[0, 0],
|
|
[100, 0],
|
|
[0, 100],
|
|
[100, 100],
|
|
],
|
|
[bound]
|
|
);
|
|
const neighbors = graph.neighbors([0, 0]);
|
|
expect(neighbors.length).toBe(1);
|
|
expect(neighbors[0][0]).toBe(100);
|
|
expect(neighbors[0][1]).toBe(0);
|
|
});
|
|
});
|