Skip to content

Commit 3568e32

Browse files
committed
test: use a different package to test patches
1 parent bf1e727 commit 3568e32

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/agent.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,50 +2129,50 @@ test('#active: false', function (t) {
21292129
test('patches', function (t) {
21302130
t.test('#clearPatches(name)', function (t) {
21312131
const agent = new Agent().start();
2132-
t.ok(agent._instrumentation._patcherReg.has('express'));
2133-
t.doesNotThrow(() => agent.clearPatches('express'));
2134-
t.notOk(agent._instrumentation._patcherReg.has('express'));
2132+
t.ok(agent._instrumentation._patcherReg.has('generic-pool'));
2133+
t.doesNotThrow(() => agent.clearPatches('generic-pool'));
2134+
t.notOk(agent._instrumentation._patcherReg.has('generic-pool'));
21352135
t.doesNotThrow(() => agent.clearPatches('does-not-exists'));
21362136
agent.destroy();
21372137
t.end();
21382138
});
21392139

21402140
t.test('#addPatch(name, moduleName)', function (t) {
21412141
const agent = new Agent();
2142-
agent.clearPatches('express');
2142+
agent.clearPatches('generic-pool');
21432143
agent.start(agentOptsNoopTransport);
21442144

2145-
agent.addPatch('express', './test/_patch.js');
2145+
agent.addPatch('generic-pool', './test/_patch.js');
21462146

2147-
const before = require('express');
2147+
const before = require('generic-pool');
21482148
const patch = require('./_patch');
21492149

2150-
delete require.cache[require.resolve('express')];
2151-
t.deepEqual(require('express'), patch(before));
2150+
delete require.cache[require.resolve('generic-pool')];
2151+
t.deepEqual(require('generic-pool'), patch(before));
21522152

21532153
agent.destroy();
21542154
t.end();
21552155
});
21562156

21572157
t.test('#addPatch(name, function) - does not exist', function (t) {
21582158
const agent = new Agent();
2159-
agent.clearPatches('express');
2159+
agent.clearPatches('generic-pool');
21602160
agent.start(agentOptsNoopTransport);
21612161

21622162
var replacement = {
21632163
foo: 'bar',
21642164
};
21652165

2166-
agent.addPatch('express', (exports, agent, { version, enabled }) => {
2166+
agent.addPatch('generic-pool', (exports, agent, { version, enabled }) => {
21672167
t.ok(exports);
21682168
t.ok(agent);
21692169
t.ok(version);
21702170
t.ok(enabled);
21712171
return replacement;
21722172
});
21732173

2174-
delete require.cache[require.resolve('express')];
2175-
t.deepEqual(require('express'), replacement);
2174+
delete require.cache[require.resolve('generic-pool')];
2175+
t.deepEqual(require('generic-pool'), replacement);
21762176

21772177
agent.destroy();
21782178
t.end();

0 commit comments

Comments
 (0)