Skip to content

Commit a6b6f89

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test: align consumer assertions with consolidated chip APIs
1 parent 5705a31 commit a6b6f89

2 files changed

Lines changed: 12 additions & 20 deletions

File tree

‎apps/sim/components/emails/_styles/base.tokens.test.ts‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
*/
88
import { readFileSync } from 'node:fs'
99
import { join } from 'node:path'
10+
import { chipGeometryClass } from '@sim/emcn/components/chip/chip-chrome'
1011
import { describe, expect, it } from 'vitest'
1112
import { baseStyles, colors, typography } from '@/components/emails/_styles'
1213

1314
const APP_ROOT = join(__dirname, '../../..')
1415

1516
const globalsCss = readFileSync(join(APP_ROOT, 'app/_styles/globals.css'), 'utf8')
16-
const chipChrome = readFileSync(
17-
join(APP_ROOT, '../../packages/emcn/src/components/chip/chip-chrome.ts'),
18-
'utf8'
19-
)
2017

2118
/**
2219
* The type scale moved into the `@theme` block when the v4 upgrade removed
@@ -85,7 +82,7 @@ describe('email type scale mirrors the globals.css @theme scale', () => {
8582
it('sm is Tailwind stock 14px — the size text-sm resolves to in chip chrome', () => {
8683
expect(typography.fontSize.sm).toBe('14px')
8784
expect(tailwindFontSize.sm).toBeUndefined()
88-
expect(chipChrome).toContain('text-sm')
85+
expect(chipGeometryClass).toContain('text-sm')
8986
})
9087

9188
it('display is deliberately off-scale — the platform has no headline numeral', () => {
@@ -101,18 +98,9 @@ describe('email geometry mirrors the platform', () => {
10198
})
10299

103100
it('the CTA transcribes chipGeometryClass', () => {
104-
// chipGeometryClass composes the unrounded geometry with the default radius,
105-
// so the transcription reads both halves rather than one literal.
106-
expect(chipChrome).toMatch(
107-
/chipGeometryClass = `\$\{chipGeometryUnroundedClass\} \$\{chipRadiusClass\}`/
108-
)
109-
const unrounded = chipChrome.match(/chipGeometryUnroundedClass = `([^`]+)`/)?.[1]
110-
const radius = chipChrome.match(/chipRadiusClass = '([^']+)'/)?.[1]
111-
expect(unrounded).toBeDefined()
112-
expect(radius).toBeDefined()
113-
const geometry = `${unrounded} ${radius}`
101+
// Read the composed token so splitting shared constants cannot hide drift.
114102
for (const token of ['h-[30px]', 'rounded-lg', 'px-2', 'text-sm']) {
115-
expect(geometry).toContain(token)
103+
expect(chipGeometryClass).toContain(token)
116104
}
117105

118106
expect(baseStyles.button.lineHeight).toBe('30px')

‎apps/sim/ee/credential-groups/components/organization-workspace-grant-modal.test.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('workspace integration grant editor', () => {
5959
return result
6060
}
6161
function integrationOption(label: string) {
62-
const result = [...document.querySelectorAll<HTMLElement>('[role="menuitem"]')].find(
62+
const result = [...document.querySelectorAll<HTMLElement>('[role="menuitemcheckbox"]')].find(
6363
(element) => element.textContent === label
6464
)
6565
if (!result) throw new Error(`Missing ${label} option`)
@@ -98,7 +98,9 @@ describe('workspace integration grant editor', () => {
9898
await selectWorkspace()
9999
expect(button('Add workspace').disabled).toBe(true)
100100
await openIntegrations()
101-
expect(document.querySelector('[role="menuitem"]')?.textContent).toBe('All integrations')
101+
expect(document.querySelector('[role="menuitemcheckbox"]')?.textContent).toBe(
102+
'All integrations'
103+
)
102104
await act(async () => integrationOption('Gmail').click())
103105
await closeIntegrations()
104106
expect(button('Add workspace').disabled).toBe(false)
@@ -126,7 +128,9 @@ describe('workspace integration grant editor', () => {
126128
it('narrows broad access when a specific integration is selected', async () => {
127129
await render()
128130
await openIntegrations()
129-
expect(document.querySelector('[role="menuitem"]')?.textContent).toBe('All integrations')
131+
expect(document.querySelector('[role="menuitemcheckbox"]')?.textContent).toBe(
132+
'All integrations'
133+
)
130134
await act(async () => integrationOption('Gmail').click())
131135
await closeIntegrations()
132136
await click('Save access')
@@ -200,7 +204,7 @@ describe('workspace integration grant editor', () => {
200204
search?.dispatchEvent(new Event('input', { bubbles: true }))
201205
})
202206
expect(
203-
[...document.querySelectorAll('[role="menuitem"]')].map((item) => item.textContent)
207+
[...document.querySelectorAll('[role="menuitemcheckbox"]')].map((item) => item.textContent)
204208
).toEqual(['Google Calendar'])
205209
await act(async () => integrationOption('Google Calendar').click())
206210
await closeIntegrations()

0 commit comments

Comments
 (0)