File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const fetcher = jest.fn()
2
2
jest . mock ( '../lib/fetch' , ( ) => fetcher )
3
3
4
4
import { createSuccess } from './test-helpers/factories'
5
+ import { version } from '../../package.json'
5
6
import { Analytics } from '..'
6
7
import { resolveCtx } from './test-helpers/resolve-ctx'
7
8
@@ -50,6 +51,7 @@ describe('Analytics Node', () => {
50
51
`
51
52
)
52
53
const body = JSON . parse ( httpRes . body )
54
+
53
55
expect ( body ) . toMatchInlineSnapshot (
54
56
{
55
57
batch : [
@@ -58,12 +60,6 @@ describe('Analytics Node', () => {
58
60
_metadata : {
59
61
nodeVersion : expect . any ( String ) ,
60
62
} ,
61
-
62
- context : {
63
- library : {
64
- version : expect . any ( String ) ,
65
- } ,
66
- } ,
67
63
} ,
68
64
] ,
69
65
} ,
@@ -77,7 +73,7 @@ describe('Analytics Node', () => {
77
73
"context": Object {
78
74
"library": Object {
79
75
"name": "AnalyticsNode",
80
- "version": Any<String> ,
76
+ "version": " ${ version } " ,
81
77
},
82
78
},
83
79
"integrations": Object {},
Original file line number Diff line number Diff line change 1
1
import { CoreContext , CorePlugin } from '@segment/analytics-core'
2
2
import { Publisher , PublisherProps } from './publisher'
3
+ import { version } from '../../../package.json'
3
4
4
5
function normalizeEvent ( ctx : CoreContext ) {
5
6
ctx . updateEvent ( 'context.library.name' , 'AnalyticsNode' )
6
- ctx . updateEvent ( 'context.library.version' , '1.0.0' )
7
+ ctx . updateEvent ( 'context.library.version' , version )
7
8
ctx . updateEvent ( '_metadata.nodeVersion' , process . versions . node )
8
9
}
9
10
You can’t perform that action at this time.
0 commit comments