Files
AFFiNE-Mirror/blocksuite/affine/block-surface/src/__tests__/graph.unit.spec.ts
T
2024-12-20 15:38:06 +08:00

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);
});
});