node/test/async-hooks/test-async-local-storage-misc-stores.js
Antoine du Hamel bfc81ca228
test: ensure assertions are reachable in test/async-hooks
PR-URL: https://github.com/nodejs/node/pull/60150
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2025-10-09 21:57:24 +00:00

16 lines
483 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { AsyncLocalStorage } = require('async_hooks');
const asyncLocalStorage = new AsyncLocalStorage();
asyncLocalStorage.run('hello node', common.mustCall(() => {
assert.strictEqual(asyncLocalStorage.getStore(), 'hello node');
}));
const runStore = { hello: 'node' };
asyncLocalStorage.run(runStore, common.mustCall(() => {
assert.strictEqual(asyncLocalStorage.getStore(), runStore);
}));