Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

shared-bindings.spec.ts

18 lines734 Bytes

1import { expect } from '@playwright/test'
2import { apiTest as test } from '@tanstack/router-e2e-utils'
3​
4test.beforeEach(async ({ page }) => {
5 await page.goto('/')
6})
7​
8test('shared module bindings should init once', async ({ page }) => {
9 await page.getByTestId('shared-singleton-link').click()
10​
11 // If module scope is duplicated between reference + split chunk, this becomes "2".
12 await expect(page.getByTestId('shared-init-count')).toHaveText('1')
13​
14 // Extra signals (useful when debugging failures)
15 await expect(page.getByTestId('shared-loader-saw')).toHaveText('1')
16 await expect(page.getByTestId('shared-created-at-loader')).toHaveText('1')
17 await expect(page.getByTestId('shared-created-at-module')).toHaveText('1')
18})