Files
open-design/apps/web/tests/runtime/amr-artifact-upgrade.test.ts
T
9d055a0fa6 feat(amr): add artifact-based upgrade guidance for Free users (#5591)
* feat(amr): add artifact-based upgrade guidance

* fix(amr): fail open when billing plan is unavailable

---------

Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com>
2026-07-14 08:11:07 +00:00

32 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { amrArtifactUpgradeHomeMockOffer } from '../../src/runtime/amr-artifact-upgrade';
describe('amrArtifactUpgradeHomeMockOffer', () => {
it('returns null when the Home offer mock is disabled', () => {
expect(amrArtifactUpgradeHomeMockOffer('')).toBeNull();
});
it('keeps the existing source-less mock fallback', () => {
expect(amrArtifactUpgradeHomeMockOffer('?mock-amr-artifact-upgrade-home=1')).toEqual({
sessionKey: 'local-ui-mock',
projectId: '',
conversationId: '',
fileName: null,
});
});
it('binds the mock to an exact project, conversation, and artifact', () => {
expect(amrArtifactUpgradeHomeMockOffer([
'?mock-amr-artifact-upgrade-home=1',
'mock-amr-artifact-upgrade-project=project-1',
'mock-amr-artifact-upgrade-conversation=conversation-1',
'mock-amr-artifact-upgrade-file=artifacts%2Findex.html',
].join('&'))).toEqual({
sessionKey: JSON.stringify(['project-1', 'conversation-1']),
projectId: 'project-1',
conversationId: 'conversation-1',
fileName: 'artifacts/index.html',
});
});
});