Skip to content

Commit 3879d0a

Browse files
committed
test: ✅ tidy up
1 parent d5d5af8 commit 3879d0a

File tree

29 files changed

+216
-142
lines changed

29 files changed

+216
-142
lines changed

apps/302-recipe-search-integration-testing-library-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/303-recipe-search-shallow-test-bed-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/303-recipe-search-shallow-test-bed-starter/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/303-recipe-search-shallow-testing-library-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/303-recipe-search-shallow-testing-library-starter/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/304-recipe-search-async-pipe-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/304-recipe-search-async-pipe-starter/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/305-recipe-search-signals-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/305-recipe-search-signals-starter/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

apps/401-recipe-filter-solution/src/app/recipe/recipe-search.integration.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { RecipeSearch } from './recipe-search.ng';
88

99
describe(RecipeSearch.name, () => {
1010
it('should search recipes without filtering', async () => {
11-
const { getRecipeNames } = await renderComponent();
11+
const { getRecipeNameEls } = await renderComponent();
1212

13-
expect(getRecipeNames()).toEqual(['Burger', 'Salad']);
13+
expect(getRecipeNameEls()).toHaveLength(2);
14+
expect(getRecipeNameEls()[0]).toHaveTextContent('Burger');
15+
expect(getRecipeNameEls()[1]).toHaveTextContent('Salad');
1416
});
1517

1618
async function renderComponent() {
@@ -29,8 +31,8 @@ describe(RecipeSearch.name, () => {
2931
await fixture.whenStable();
3032

3133
return {
32-
getRecipeNames() {
33-
return screen.queryAllByRole('heading').map((el) => el.textContent);
34+
getRecipeNameEls() {
35+
return screen.queryAllByRole('heading');
3436
},
3537
};
3638
}

0 commit comments

Comments
 (0)