Skip to content

Commit 21670f0

Browse files
committed
update specs
1 parent a7375b5 commit 21670f0

8 files changed

Lines changed: 23 additions & 10 deletions

File tree

05-testing/01-react/01-base/05-async/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ npm install
2020
This time, we want to handle `getMembers` errors:
2121

2222
> 403: API rate limit exceeded
23+
>
2324
> 503: Service unavailable
2425
2526
_./src/api.ts_
@@ -77,7 +78,7 @@ _./src/api.spec.ts_
7778
```javascript
7879
import { getMembers } from './api';
7980

80-
describe('api specs', () => {
81+
describe('getMembers specs', () => {
8182
it('', () => {
8283
// Arrange
8384
// Act
@@ -95,7 +96,7 @@ _./src/api.spec.ts_
9596
+ import { Member } from './api-model';
9697
import { getMembers } from './api';
9798

98-
describe('api specs', () => {
99+
describe('getMembers specs', () => {
99100
- it('', () => {
100101
+ it('should return members when it resolves the request successfully', () => {
101102
// Arrange
@@ -133,7 +134,7 @@ import Axios from 'axios';
133134
import { Member } from './api-model';
134135
import { getMembers } from './api';
135136

136-
describe('api specs', () => {
137+
describe('getMembers specs', () => {
137138
- it('should return members when it resolves the request successfully', () => {
138139
+ it('should return members when it resolves the request successfully', async () => {
139140
// Arrange

05-testing/01-react/01-base/05-async/src/api.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Axios, { AxiosError } from 'axios';
22
import { Member } from './api-model';
33
import { getMembers } from './api';
44

5-
describe('api specs', () => {
5+
describe('getMembers specs', () => {
66
it('should return members when it resolves the request successfully', async () => {
77
// Arrange
88
const members: Member[] = [

05-testing/01-react/02-components/02-name-edit/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ describe('NameEdit component specs', () => {
114114

115115
// Assert
116116
+ expect(h3Element).toBeInTheDocument();
117+
+ expect(h3Element.textContent).toEqual('');
117118
+ expect(inputElement).toBeInTheDocument();
119+
+ expect(inputElement).toHaveAttribute('value', '');
118120
});
119121
});
120122

@@ -149,8 +151,8 @@ import { NameEdit } from './name-edit';
149151
+ const h3Element = screen.getByRole('heading', { level: 3 });
150152

151153
+ // Assert
152-
+ expect(inputElement.value).toEqual('John');
153154
+ expect(h3Element.textContent).toEqual('John');
155+
+ expect(inputElement).toHaveAttribute('value', 'John');
154156
+ });
155157

156158
```

05-testing/01-react/02-components/02-name-edit/src/name-edit.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('NameEdit component specs', () => {
1515

1616
// Assert
1717
expect(h3Element).toBeInTheDocument();
18+
expect(h3Element.textContent).toEqual('');
1819
expect(inputElement).toBeInTheDocument();
20+
expect(inputElement).toHaveAttribute('value', '');
1921
});
2022

2123
it('should update h3 text when input changes', async () => {
@@ -30,7 +32,7 @@ describe('NameEdit component specs', () => {
3032
const h3Element = screen.getByRole('heading', { level: 3 });
3133

3234
// Assert
33-
expect(inputElement.value).toEqual('John');
3435
expect(h3Element.textContent).toEqual('John');
36+
expect(inputElement).toHaveAttribute('value', 'John');
3537
});
3638
});

05-testing/01-react/02-components/03-integration/src/name-edit.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('NameEdit component specs', () => {
1515

1616
// Assert
1717
expect(h3Element).toBeInTheDocument();
18+
expect(h3Element.textContent).toEqual('');
1819
expect(inputElement).toBeInTheDocument();
20+
expect(inputElement).toHaveAttribute('value', '');
1921
});
2022

2123
it('should update h3 text when input changes', async () => {
@@ -30,7 +32,7 @@ describe('NameEdit component specs', () => {
3032
const h3Element = screen.getByRole('heading', { level: 3 });
3133

3234
// Assert
33-
expect(inputElement.value).toEqual('John');
3435
expect(h3Element.textContent).toEqual('John');
36+
expect(inputElement).toHaveAttribute('value', 'John');
3537
});
3638
});

05-testing/01-react/02-components/04-fetch/src/name-edit.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('NameEdit component specs', () => {
1515

1616
// Assert
1717
expect(h3Element).toBeInTheDocument();
18+
expect(h3Element.textContent).toEqual('');
1819
expect(inputElement).toBeInTheDocument();
20+
expect(inputElement).toHaveAttribute('value', '');
1921
});
2022

2123
it('should update h3 text when input changes', async () => {
@@ -30,7 +32,7 @@ describe('NameEdit component specs', () => {
3032
const h3Element = screen.getByRole('heading', { level: 3 });
3133

3234
// Assert
33-
expect(inputElement.value).toEqual('John');
3435
expect(h3Element.textContent).toEqual('John');
36+
expect(inputElement).toHaveAttribute('value', 'John');
3537
});
3638
});

05-testing/01-react/02-components/05-router/src/name-edit.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('NameEdit component specs', () => {
1515

1616
// Assert
1717
expect(h3Element).toBeInTheDocument();
18+
expect(h3Element.textContent).toEqual('');
1819
expect(inputElement).toBeInTheDocument();
20+
expect(inputElement).toHaveAttribute('value', '');
1921
});
2022

2123
it('should update h3 text when input changes', async () => {
@@ -30,7 +32,7 @@ describe('NameEdit component specs', () => {
3032
const h3Element = screen.getByRole('heading', { level: 3 });
3133

3234
// Assert
33-
expect(inputElement.value).toEqual('John');
3435
expect(h3Element.textContent).toEqual('John');
36+
expect(inputElement).toHaveAttribute('value', 'John');
3537
});
3638
});

05-testing/01-react/02-components/06-material-ui/src/name-edit.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ describe('NameEdit component specs', () => {
1515

1616
// Assert
1717
expect(h3Element).toBeInTheDocument();
18+
expect(h3Element.textContent).toEqual('');
1819
expect(inputElement).toBeInTheDocument();
20+
expect(inputElement).toHaveAttribute('value', '');
1921
});
2022

2123
it('should update h3 text when input changes', async () => {
@@ -30,7 +32,7 @@ describe('NameEdit component specs', () => {
3032
const h3Element = screen.getByRole('heading', { level: 3 });
3133

3234
// Assert
33-
expect(inputElement.value).toEqual('John');
3435
expect(h3Element.textContent).toEqual('John');
36+
expect(inputElement).toHaveAttribute('value', 'John');
3537
});
3638
});

0 commit comments

Comments
 (0)