]*id="quickstart-panel-${id}"[^>]*>`),
+ )?.[0];
+ expect(panelTag).toContain('role="tabpanel"');
+ expect(panelTag).toContain(`aria-labelledby="quickstart-tab-${id}"`);
+ if (selected) {
+ expect(panelTag).not.toContain('hidden=""');
+ } else {
+ expect(panelTag).toContain('hidden=""');
+ }
+ }
+ });
+
+ it('preserves the loopback binding, quoted placeholders, and official image', () => {
+ const command = panel('command');
+ expect(command).toContain('-p 127.0.0.1:10260:10260');
+ expect(command).not.toContain('-p 10260:10260 ');
+ expect(command).toContain("--username '<YOUR_USERNAME>'");
+ expect(command).toContain("--password '<YOUR_PASSWORD>'");
+ expect(command).toContain('ghcr.io/documentdb/documentdb/documentdb-local:latest');
+ expect(command).not.toContain('--init-data');
+ });
+
+ it('labels setup workflows and identifies the extension before selection', () => {
+ const selector = card.slice(
+ card.indexOf('role="tablist"'),
+ card.indexOf('role="tabpanel"'),
+ );
+ expect(selector).toContain('Docker command');
+ expect(selector).toContain('Run it yourself');
+ expect(selector).toContain('Guided setup');
+ expect(selector).toContain('VS Code extension');
+ expect(selector).not.toContain('>Terminal<');
+ expect(selector).not.toContain('>VS Code<');
+ expect(card).not.toContain('Want a GUI?');
+ expect(card).not.toContain('connects to this container too');
+ });
+
+ it('states the shared Docker requirement once, outside either panel', () => {
+ const requirement = 'Both options require Docker.';
+ expect(card.split(requirement)).toHaveLength(2);
+ expect(card.indexOf(requirement)).toBeLessThan(card.indexOf('role="tablist"'));
+ expect(panel('command')).not.toContain(requirement);
+ expect(panel('guided')).not.toContain(requirement);
+ expect(panel('guided')).not.toContain('Linux containers');
+ });
+
+ it('opens the Linux packages guide from below both panels, not before the default path', () => {
+ const href = 'href="/docs/getting-started/packages"';
+ const link = card.indexOf(href);
+ expect(card.split(href)).toHaveLength(2);
+ expect(link).toBeGreaterThan(card.indexOf('id="quickstart-panel-guided"'));
+ // Closes the guided panel and the tabs wrapper, so the footer is visible from either tab.
+ expect(card.slice(0, card.lastIndexOf('
<\/div>$/);
+ expect(card.slice(link)).toMatch(/^href="[^"]+"[^>]*>Linux packages guide);
+ });
+
+ it('explains manual control and guided provisioning rather than editor choice', () => {
+ expect(card).toContain('Run it yourself');
+ expect(panel('guided')).toContain(
+ 'creates your local database, generates credentials, and saves a connection',
+ );
+ expect(card).not.toContain('smoothest experience');
+ expect(card).not.toContain('One click');
+ expect(card).not.toContain('300 MB');
+ });
+
+ it('offers one guided launch action with an honest editor and extension caption', () => {
+ expect(documentdbVsCodeLocalQuickStartDeepLink).toBe(
+ 'vscode://ms-azuretools.vscode-documentdb/local',
+ );
+ const guided = panel('guided');
+ const launch = guided.match(
+ /]*>Set up in VS Code<\/a>/,
+ )?.[0];
+ expect(launch).toContain(`href="${documentdbVsCodeLocalQuickStartDeepLink}"`);
+ expect(launch).toContain('aria-describedby="quickstart-vscode-setup-caption"');
+ expect(card.split(`href="${documentdbVsCodeLocalQuickStartDeepLink}"`)).toHaveLength(2);
+
+ const captionStart = guided.indexOf('id="quickstart-vscode-setup-caption"');
+ const caption = guided.slice(captionStart, guided.indexOf('
', captionStart));
+ expect(caption).toContain('Requires');
+ expect(caption).toContain('href="https://code.visualstudio.com/"');
+ expect(caption).toContain('You may be prompted to install');
+ expect(caption).toContain(`href="${documentdbVsCodeExtensionMarketplaceUrl}"`);
+ expect(guided).not.toContain('>Install the extension');
+ });
+
+ it('keeps both workflows concise without numbered steps', () => {
+ const command = panel('command');
+ const guided = panel('guided');
+ const editCredentials = 'Replace the username and password, then run the command.';
+ const connect = 'Then connect with your preferred client.';
+ expect(command).not.toContain('
'));
+ expect(command.indexOf('Docker setup guide')).toBeGreaterThan(command.indexOf(connect));
+ expect(command).not.toContain('Connect on 127.0.0.1:10260 with your app');
+ expect(command).not.toContain('Run your first query.');
+ expect(guided).not.toContain(' {
+ expect(card).not.toMatch(/version \d+\.\d+\.\d+/i);
+ expect(card).not.toMatch(/\d+\.\d+\.\d+ or (later|newer|above)/i);
+ expect(card).not.toMatch(/\bv\d+\.\d+\.\d+\b/);
+ });
+
+ it('exports a permanent full-guide link for each path without timed retry UI', () => {
+ expect(panel('command')).toContain('href="/docs/getting-started/docker"');
+ expect(panel('command')).toContain('Docker setup guide');
+ expect(panel('guided')).toContain(`href="${vscodeGuideUrl}"`);
+ expect(panel('guided')).toContain('VS Code setup guide');
+ expect(panel('guided').indexOf('>VS Code setup guide')).toBeGreaterThan(
+ panel('guided').indexOf('When setup finishes, select Open Connection'),
+ );
+ expect(card).not.toContain('Nothing happened?');
+ expect(card).not.toContain('Not working in VS Code?');
+ expect(panel('guided')).not.toContain('role="status"');
+ });
+
+ it('omits the existing-instance footer from the homepage', () => {
+ expect(card).not.toContain('id="quickstart-existing-connection"');
+ expect(card).not.toContain('Already running DocumentDB?');
+ expect(card).not.toContain('Connect your existing instance in VS Code.');
+ expect(card).not.toContain(`href="${existingConnectionUrl}"`);
+ });
+});
+
+describe('VS Code quick-start guide', () => {
+ it('renders the existing-instance destination using the shared heading algorithm', () => {
+ expect(vscodeExistingConnectionSectionAnchor).toBe(
+ headingAnchor(vscodeExistingConnectionSectionTitle),
+ );
+ expect(vscodeExistingConnectionSectionAnchor).toBe('connect-an-existing-instance');
+ expect(guideHtml).toContain(`id="${vscodeExistingConnectionSectionAnchor}"`);
+ expect(guideHtml).toContain('id="set-up-document-db-local"');
+ });
+
+ it('keeps guided setup first and connects an existing instance without provisioning', () => {
+ const setup = guideContent.indexOf('## Set up DocumentDB Local');
+ const manual = guideContent.indexOf('## Alternative: start the container yourself');
+ const connect = guideContent.indexOf(`## ${vscodeExistingConnectionSectionTitle}`);
+ expect(setup).toBeGreaterThan(-1);
+ expect(manual).toBeGreaterThan(setup);
+ expect(connect).toBeGreaterThan(manual);
+ const instructions = guideContent.slice(
+ connect,
+ guideContent.indexOf('## Verify the connection in the extension'),
+ );
+ expect(instructions).toContain('instance that is already running');
+ expect(instructions).toContain('do not need to run the setup wizard or create another container');
+ expect(instructions).toContain('New Local Connection');
+ expect(instructions).toContain("your instance's port");
+ expect(instructions).not.toContain('docker run');
+ });
+
+ it('explains both sample-data defaults without assuming a specific database exists', () => {
+ const verification = guideContent.slice(
+ guideContent.indexOf('## Verify the connection in the extension'),
+ guideContent.indexOf('## Import, export, and querying'),
+ );
+ expect(verification).toContain('Guided setup loads sample data by default unless you turn that option off');
+ expect(verification).toContain('manual Docker command above starts without sample data');
+ expect(verification).toContain('An empty instance is expected when sample data is disabled');
+ expect(verification).toContain('add a test document');
+ expect(verification).not.toContain('StoreData');
+ expect(verification).not.toContain('sampledb');
+ });
+
+ it('retains prerequisites and launch recovery in the guide', () => {
+ expect(guideContent).toContain('## Prerequisites');
+ expect(guideContent).toContain('Docker Desktop or Docker Engine');
+ expect(guideContent).toContain('container and persistent data volume');
+ expect(guideContent).toContain('It does not install Docker.');
+ expect(guideContent).not.toContain('changes nothing else on your machine');
+ expect(guideContent).toContain('DocumentDB: Set up DocumentDB Local');
+ expect(guideContent).toContain('No extension gallery service configured');
+ expect(guideContent).toContain('code --install-extension ms-azuretools.vscode-documentdb');
+ });
+});
diff --git a/vitest.config.mts b/vitest.config.mts
new file mode 100644
index 0000000..21215b0
--- /dev/null
+++ b/vitest.config.mts
@@ -0,0 +1,9 @@
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ oxc: {
+ jsx: {
+ runtime: 'automatic',
+ },
+ },
+});