Skip to content

Commit e9ed7cf

Browse files
committed
fix: update headline component Jest test to not use async forEach
1 parent feba331 commit e9ed7cf

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/components/bolt-headline/__tests__/headline.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import { render } from '@bolt/twig-renderer';
1+
import { render, stopServer, html } from '../../../testing/testing-helpers';
22

33
const { readYamlFileSync } = require('@bolt/build-tools/utils/yaml');
44
const { join } = require('path');
55
const schema = readYamlFileSync(join(__dirname, '../headline.schema.yml'));
66
const { tag, size, align, transform } = schema.properties;
77

88
describe('<bolt-headline> Component', () => {
9+
afterAll(async () => {
10+
await stopServer();
11+
}, 100);
12+
913
test('basic usage headline', async () => {
1014
const results = await render('@bolt-components-headline/headline.twig', {
1115
text: 'this is a headline',
@@ -21,6 +25,7 @@ describe('<bolt-headline> Component', () => {
2125
expect(results.ok).toBe(true);
2226
expect(results.html).toMatchSnapshot();
2327
});
28+
2429
test('basic usage eyebrow', async () => {
2530
const results = await render('@bolt-components-headline/eyebrow.twig', {
2631
text: 'this is an eyebrow',
@@ -54,7 +59,7 @@ describe('<bolt-headline> Component', () => {
5459
expect(results.html).toMatchSnapshot();
5560
});
5661

57-
tag.enum.forEach(async displayChoice => {
62+
tag.enum.forEach(displayChoice => {
5863
test(`tag display: ${displayChoice}`, async () => {
5964
const results = await render('@bolt-components-headline/headline.twig', {
6065
tag: displayChoice,
@@ -65,7 +70,7 @@ describe('<bolt-headline> Component', () => {
6570
});
6671
});
6772

68-
align.enum.forEach(async alignmentChoice => {
73+
align.enum.forEach(alignmentChoice => {
6974
test(`text alignment: ${alignmentChoice}`, async () => {
7075
const results = await render('@bolt-components-headline/headline.twig', {
7176
align: alignmentChoice,
@@ -76,10 +81,10 @@ describe('<bolt-headline> Component', () => {
7681
});
7782
});
7883

79-
size.enum.forEach(async sizeChoice => {
84+
size.enum.forEach(sizeChoice => {
8085
const fontWeight = ['bold', 'regular', 'semibold'];
8186

82-
fontWeight.forEach(async weightChoice => {
87+
fontWeight.forEach(weightChoice => {
8388
test(`Sizes at all varient font weights: ${sizeChoice}, ${weightChoice}`, async () => {
8489
const results = await render(
8590
'@bolt-components-headline/headline.twig',
@@ -95,10 +100,10 @@ describe('<bolt-headline> Component', () => {
95100
});
96101
});
97102

98-
size.enum.forEach(async sizeChoice => {
103+
size.enum.forEach(sizeChoice => {
99104
const fontStyle = ['normal', 'italic'];
100105

101-
fontStyle.forEach(async fontChoice => {
106+
fontStyle.forEach(fontChoice => {
102107
test(`Sizes at all varient font styles: ${sizeChoice}, ${fontChoice}`, async () => {
103108
const results = await render(
104109
'@bolt-components-headline/headline.twig',
@@ -114,7 +119,7 @@ describe('<bolt-headline> Component', () => {
114119
});
115120
});
116121

117-
transform.enum.forEach(async caseChoice => {
122+
transform.enum.forEach(caseChoice => {
118123
test(`text casing: ${caseChoice}`, async () => {
119124
const results = await render('@bolt-components-headline/headline.twig', {
120125
transform: caseChoice,

0 commit comments

Comments
 (0)