Skip to content

Commit 482e8fc

Browse files
committed
fix: adding a test scaffold for future proofing
1 parent ef698d1 commit 482e8fc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/jest/acceptance/instrumentation.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,32 @@ describe('instrumentation module', () => {
102102
INSTRUMENTATION_SCHEMA,
103103
);
104104
});
105+
106+
it('sends remapped v1 analytics data to the v2 instrumentation endpoint', async () => {
107+
const project = await createProjectFromWorkspace(fixtureName);
108+
const { code } = await runSnykCLI('test --debug', {
109+
cwd: project.path(),
110+
env,
111+
});
112+
113+
expect(code).toBe(0);
114+
115+
// find the instrumentation request
116+
const instrumentationRequest = server
117+
.getRequests()
118+
.filter((value) =>
119+
(value.url as string).includes(
120+
`/api/hidden/orgs/${snykOrg}/analytics`,
121+
),
122+
)
123+
.pop();
124+
125+
expect(instrumentationRequest?.body.data.attributes.interaction.extension).toEqual(
126+
expect.objectContaining({
127+
"some-iac-command-only-found-in-v1": "1234",
128+
}),
129+
);
130+
});
105131
});
106132

107133
describe.each(['VS_CODE', 'JETBRAINS_IDE', 'VISUAL_STUDIO', 'ECLIPSE'])(

0 commit comments

Comments
 (0)