Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/featured/messaging-lab.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Messaging Lab
tagline: Text messaging services to deliver critical updates to the people you serve.
order: 2
links:
- label: flexion/flexion-notify
url: https://github.com/flexion/flexion-notify
- label: flexion/flexion-messaging
url: https://github.com/flexion/flexion-messaging
kind: repo
---
2 changes: 1 addition & 1 deletion data/overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ forms-lab:
category: product
featured: true

flexion-notify:
flexion-messaging:
tier: active
category: product
featured: true
Expand Down
2 changes: 1 addition & 1 deletion src/design/components/lab-card/examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const singleLink: FeaturedLab = {
tagline: 'Text messaging services to deliver critical updates to the people you serve.',
order: 2,
links: [
{ label: 'flexion/flexion-notify', url: 'https://github.com/flexion/flexion-notify', kind: 'repo' },
{ label: 'flexion/flexion-messaging', url: 'https://github.com/flexion/flexion-messaging', kind: 'repo' },
],
}

Expand Down
54 changes: 23 additions & 31 deletions tests/build/featured.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,38 @@ import { loadFeatured } from '../../src/build/featured'
const ROOT = import.meta.dir + '/../..'

describe('loadFeatured', () => {
test('loads every file in content/featured/ and returns them sorted by order', async () => {
test('all content/featured/ files load without error', async () => {
const labs = await loadFeatured(ROOT)
expect(labs.map((l) => l.title)).toEqual([
'Forms Lab',
'Messaging Lab',
'Document Extractor Lab',
])
expect(labs.length).toBeGreaterThan(0)
})

test('Forms Lab has four typed links in document order', async () => {
test('every lab has required fields', async () => {
const labs = await loadFeatured(ROOT)
const forms = labs.find((l) => l.title === 'Forms Lab')!
expect(forms.tagline).toBe(
'Digitize forms to create modern, accessible experiences for public outreach.',
)
expect(forms.order).toBe(1)
expect(forms.links).toHaveLength(4)
expect(forms.links.map((l) => l.kind)).toEqual(['demo', 'repo', 'demo', 'repo'])
expect(forms.links[0]).toEqual({
label: 'Forms Platform',
url: 'https://10x-forms.labs.flexion.us/',
kind: 'demo',
})
for (const lab of labs) {
expect(typeof lab.title).toBe('string')
expect(lab.title.length).toBeGreaterThan(0)
expect(typeof lab.tagline).toBe('string')
expect(lab.tagline.length).toBeGreaterThan(0)
expect(typeof lab.order).toBe('number')
expect(lab.links.length).toBeGreaterThan(0)
}
})

test('Messaging Lab has a single repo link', async () => {
test('every link has a valid kind and required fields', async () => {
const labs = await loadFeatured(ROOT)
const messaging = labs.find((l) => l.title === 'Messaging Lab')!
expect(messaging.links).toEqual([
{
label: 'flexion/flexion-notify',
url: 'https://github.com/flexion/flexion-notify',
kind: 'repo',
},
])
const validKinds = new Set(['demo', 'repo', 'case-study'])
for (const lab of labs) {
for (const link of lab.links) {
expect(typeof link.label).toBe('string')
expect(typeof link.url).toBe('string')
expect(validKinds.has(link.kind)).toBe(true)
}
}
})

test('Document Extractor Lab has repo and case-study kinds', async () => {
test('labs are sorted by order', async () => {
const labs = await loadFeatured(ROOT)
const doc = labs.find((l) => l.title === 'Document Extractor Lab')!
expect(doc.links.map((l) => l.kind)).toEqual(['repo', 'case-study'])
const orders = labs.map((l) => l.order)
expect(orders).toEqual([...orders].sort((a, b) => a - b))
})
})
4 changes: 2 additions & 2 deletions tests/views/components.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('LabCard', () => {
tagline: 'Text messaging services.',
order: 2,
links: [
{ label: 'flexion/flexion-notify', url: 'https://github.com/flexion/flexion-notify', kind: 'repo' },
{ label: 'flexion/flexion-messaging', url: 'https://github.com/flexion/flexion-messaging', kind: 'repo' },
],
}

Expand Down Expand Up @@ -145,7 +145,7 @@ describe('LabCard', () => {
const html = await renderToHtml(<LabCard lab={singleLink} />)
expect(html.match(/class="lab-card__column"/g)?.length).toBe(1)
expect(html).toContain('>Repository<')
expect(html).toContain('href="https://github.com/flexion/flexion-notify"')
expect(html).toContain('href="https://github.com/flexion/flexion-messaging"')
})

test('case-study kind renders its own column and heading', async () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/views/home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const featured: FeaturedLab[] = [
tagline: 'Text messaging services to deliver critical updates to the people you serve.',
order: 2,
links: [
{ label: 'flexion/flexion-notify', url: 'https://github.com/flexion/flexion-notify', kind: 'repo' },
{ label: 'flexion/flexion-messaging', url: 'https://github.com/flexion/flexion-messaging', kind: 'repo' },
],
},
{
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Home', () => {
test('renders each labs links inside its card', async () => {
const html = await renderToHtml(<Home hero={hero} featured={featured} config={config} />)
expect(html).toContain('href="https://github.com/flexion/forms"')
expect(html).toContain('href="https://github.com/flexion/flexion-notify"')
expect(html).toContain('href="https://github.com/flexion/flexion-messaging"')
expect(html).toContain('href="https://github.com/flexion/document-extractor"')
})

Expand Down
Loading