feat(watchlist): add company identity catalog
Embed a pinned FinanceDatabase equity snapshot, add authenticated company search and identity-based follows, preserve legacy assets, and map selected Yahoo symbols for collection. Refs #19 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -35,7 +35,7 @@ async function login(page, baseURL, email, password) {
|
||||
await expect(page).toHaveURL(new URL('/', baseURL).href)
|
||||
}
|
||||
|
||||
test('admin creates a user who follows a fake index and generates a private summary without article/job writes', async ({ page, request }) => {
|
||||
test('admin creates a user who follows a fake company and generates a private summary without article/job writes', async ({ page, request }) => {
|
||||
const stack = readStackManifest()
|
||||
await page.context().route('**/*', async route => {
|
||||
const host = new URL(route.request().url()).hostname
|
||||
@ -60,17 +60,45 @@ test('admin creates a user who follows a fake index and generates a private summ
|
||||
await page.getByRole('button', { name: 'Déconnexion' }).click()
|
||||
})
|
||||
|
||||
await test.step('new user login and explicit fake OpenFIGI selection', async () => {
|
||||
let companySearchRequest
|
||||
let companyFollowRequest
|
||||
page.on('request', request => {
|
||||
const url = new URL(request.url())
|
||||
if (url.pathname === '/api/companies/search') companySearchRequest = url
|
||||
if (url.pathname === '/api/me/assets' && request.method() === 'POST') companyFollowRequest = request.postDataJSON()
|
||||
})
|
||||
|
||||
await test.step('new user searches by company name and follows the selected local catalog company', async () => {
|
||||
await login(page, baseURL, email, password)
|
||||
|
||||
// Seed a pre-existing legacy follow through the compatibility API so the
|
||||
// real Watchlist page can prove it remains present after a company follow.
|
||||
const token = await page.evaluate(() => localStorage.getItem('token'))
|
||||
const legacy = await request.post(new URL('/api/me/assets', stack.apiUrl).href, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
data: { symbol: 'LEGACYIDX', name: 'Historic index follow' },
|
||||
})
|
||||
expect(legacy.status()).toBe(201)
|
||||
|
||||
await page.goto(new URL('/assets', baseURL).href)
|
||||
const query = page.getByRole('textbox', { name: 'Nom ou symbole' })
|
||||
await query.fill(fixture.indexQuery)
|
||||
const oldFollows = page.getByRole('region', { name: /autres suivis existants/i })
|
||||
await expect(oldFollows).toContainText('Historic index follow')
|
||||
const query = page.getByRole('textbox', { name: "Nom de l'entreprise" })
|
||||
await query.fill(fixture.companyQuery)
|
||||
await page.getByRole('button', { name: 'Rechercher' }).click()
|
||||
const results = page.getByRole('region', { name: 'Résultats de recherche' })
|
||||
await expect(results.getByText(fixture.indexName)).toBeVisible()
|
||||
await expect(results.getByText(fixture.indexSymbol)).toBeVisible()
|
||||
await results.getByRole('button', { name: 'Suivre cet indice' }).click()
|
||||
await expect(page.getByRole('region', { name: 'Indices suivis' })).toContainText(fixture.indexSymbol)
|
||||
const results = page.getByRole('region', { name: 'Résultats des entreprises' })
|
||||
await expect(results.getByText(fixture.companyName)).toBeVisible()
|
||||
await expect(results).toContainText('E2E Country')
|
||||
for (const privateValue of [fixture.companySymbol, fixture.companyFIGI, fixture.companyID]) {
|
||||
await expect(results.getByText(privateValue, { exact: false })).toHaveCount(0)
|
||||
}
|
||||
await results.getByRole('button', { name: 'Suivre cette entreprise' }).click()
|
||||
await expect(page.getByRole('region', { name: 'Entreprises suivies' })).toContainText(fixture.companyName)
|
||||
await expect(oldFollows).toContainText('Historic index follow')
|
||||
await expect(companySearchRequest?.pathname).toBe('/api/companies/search')
|
||||
await expect(companySearchRequest?.searchParams.get('q')).toBe(fixture.companyQuery)
|
||||
await expect(companySearchRequest?.searchParams.get('limit')).toBe('20')
|
||||
expect(companyFollowRequest).toEqual({ company_id: fixture.companyID })
|
||||
})
|
||||
|
||||
await test.step('user saves language and ranking preferences', async () => {
|
||||
@ -105,7 +133,9 @@ test('admin creates a user who follows a fake index and generates a private summ
|
||||
const response = await request.get(new URL(stack.fakeAuditPath, stack.fakeControlUrl).href)
|
||||
expect(response.ok()).toBeTruthy()
|
||||
const events = await response.json()
|
||||
expect(events.openfigiSearches).toBeGreaterThan(0)
|
||||
expect(events.openfigiSearches).toBe(0)
|
||||
expect(events.companySearches).toBeGreaterThan(0)
|
||||
expect(events.companyResolutions).toBeGreaterThan(0)
|
||||
expect(events.scraperCalls).toBeGreaterThan(0)
|
||||
expect(events.layaRankingCalls).toBeGreaterThan(0)
|
||||
expect(events.layaSummaryCalls).toBeGreaterThan(0)
|
||||
|
||||
Reference in New Issue
Block a user