-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathmemory.test.ts
More file actions
39 lines (36 loc) · 1.05 KB
/
memory.test.ts
File metadata and controls
39 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import {existsSync} from 'node:fs';
import {rm} from 'node:fs/promises';
import {tmpdir} from 'node:os';
import {join} from 'node:path';
import {describe, it} from 'node:test';
import {takeMemorySnapshot} from '../../src/tools/memory.js';
import {withMcpContext} from '../utils.js';
describe('memory', () => {
describe('take_memory_snapshot', () => {
it('with default options', async () => {
await withMcpContext(async (response, context) => {
const filePath = join(tmpdir(), 'test-screenshot.heapsnapshot');
try {
await takeMemorySnapshot.handler(
{params: {filePath}},
response,
context,
);
assert.equal(
response.responseLines.at(0),
`Heap snapshot saved to ${filePath}`,
);
assert.ok(existsSync(filePath));
} finally {
await rm(filePath, {force: true});
}
});
});
});
});