forked from sidorares/node-mysql2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update events that are propagated from pool cluster to include r…
…emove (sidorares#2114) * Add test for events being propegated through promise wrapper for pool cluster * Propagate pool cluster remove event and don't propegate events that don't happen * Move pool cluster promise test to builtin-runner * Update PoolCluster.d.ts to match promise.d.ts for pool cluster events
- Loading branch information
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/builtin-runner/integration/pool-cluster/test-promise-wrapper.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { describe, it, before, after } from 'node:test'; | ||
import assert from 'node:assert'; | ||
import common from '../../../common.js'; | ||
import { createPoolCluster } from "../../../../promise.js" | ||
|
||
describe('Test pool cluster', { timeout: 1000 }, () => { | ||
|
||
it('should propagate warn event to promise wrapper', (t, done) => { | ||
|
||
const poolCluster = createPoolCluster(); | ||
/* eslint-disable no-invalid-this */ | ||
poolCluster | ||
.once('warn', function () { | ||
assert.equal(this, poolCluster); | ||
done(); | ||
}) | ||
/* eslint-enable no-invalid-this */ | ||
poolCluster.poolCluster.emit('warn', new Error()); | ||
}); | ||
|
||
it('should propagate remove event to promise wrapper', (t, done) => { | ||
|
||
const poolCluster = createPoolCluster(); | ||
/* eslint-disable no-invalid-this */ | ||
poolCluster | ||
.once('remove', function () { | ||
assert.equal(this, poolCluster); | ||
done(); | ||
}); | ||
/* eslint-enable no-invalid-this */ | ||
poolCluster.poolCluster.emit('remove'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters