Skip to content

Commit 95ed4c4

Browse files
committed
fix test
1 parent b56edaa commit 95ed4c4

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

test/versioned/langchain/runnables.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,19 @@ function runRunnablesTests(config) {
4141
arrayParserOutput
4242
} = config
4343

44-
test('should log tracking metrics', function(t) {
45-
const { agent, langchainCoreVersion } = t.nr
46-
assertPackageMetrics({ agent, pkg: '@langchain/core', version: langchainCoreVersion })
44+
test('should log tracking metrics', function(t, end) {
45+
t.plan(5)
46+
const { agent, langchainCoreVersion, model, prompt } = t.nr
47+
helper.runInTransaction(agent, async () => {
48+
await prompt.pipe(model).invoke(inputData)
49+
assertPackageMetrics({
50+
agent,
51+
pkg: '@langchain/core',
52+
version: langchainCoreVersion,
53+
subscriberType: true
54+
}, { assert: t.assert })
55+
end()
56+
})
4757
})
4858

4959
test('should create langchain events for every invoke call', (t, end) => {

test/versioned/langchain/tools.test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,20 @@ test.afterEach((ctx) => {
3939
removeMatchedModules(/custom-tool\.js$/)
4040
})
4141

42-
test('should log tracking metrics', function(t) {
43-
const { agent } = t.nr
42+
test('should log tracking metrics', function(t, end) {
43+
t.plan(5)
44+
const { agent, tool, input } = t.nr
4445
const { version } = require('@langchain/core/package.json')
45-
assertPackageMetrics({ agent, pkg: '@langchain/core', version })
46+
helper.runInTransaction(agent, async () => {
47+
await tool.call(input)
48+
assertPackageMetrics({
49+
agent,
50+
pkg: '@langchain/core',
51+
version,
52+
subscriberType: true
53+
}, { assert: t.assert })
54+
end()
55+
})
4656
})
4757

4858
test('should create span on successful tools create', (t, end) => {

0 commit comments

Comments
 (0)