@@ -14,21 +14,21 @@ describe('The webpage', () => {
14
14
* HEADER
15
15
*/
16
16
describe ( 'header' , ( ) => {
17
- it ( 'should exist' , ( ) => {
17
+ it ( 'should exist @header ' , ( ) => {
18
18
const header = doc . querySelector ( '.header' ) ;
19
- assert . isOk ( header ) ;
19
+ assert . isOk ( header , 'We need a `.header` element.' ) ;
20
20
} ) ;
21
21
22
- it ( 'should have a non-empty title' , ( ) => {
22
+ it ( 'should have a non-empty title @header ' , ( ) => {
23
23
const h1 = doc . querySelector ( '.header h1' ) ;
24
- assert . isOk ( h1 ) ;
25
- assert . isOk ( h1 . textContent ) ;
24
+ assert . isOk ( h1 , 'We need an `h1` element inside `.header`.' ) ;
25
+ assert . isOk ( h1 . textContent , 'Our header\'s `h1` element cannot be empty.' ) ;
26
26
} ) ;
27
27
28
- it ( 'should have a non-empty description' , ( ) => {
28
+ it ( 'should have a non-empty description @header ' , ( ) => {
29
29
const h2 = doc . querySelector ( '.header h2' ) ;
30
- assert . isOk ( h2 ) ;
31
- assert . isOk ( h2 . textContent ) ;
30
+ assert . isOk ( h2 , 'We need an `h2` element inside `.header`.' ) ;
31
+ assert . isOk ( h2 . textContent , 'Our header\'s `h2` element cannot be empty.' ) ;
32
32
} ) ;
33
33
} ) ;
34
34
@@ -37,65 +37,65 @@ describe('The webpage', () => {
37
37
* TAGLINE
38
38
*/
39
39
describe ( 'tagline' , ( ) => {
40
- it ( 'should exist' , ( ) => {
40
+ it ( 'should exist @tagline ' , ( ) => {
41
41
const tagline = doc . querySelector ( '.tagline' ) ;
42
- assert . isOk ( tagline ) ;
42
+ assert . isOk ( tagline , 'We need a `.tagline` element.' ) ;
43
43
} ) ;
44
44
45
- it ( 'should have a non-empty h3 tag' , ( ) => {
45
+ it ( 'should have a non-empty h3 tag @tagline ' , ( ) => {
46
46
const h3 = doc . querySelector ( '.tagline h3' ) ;
47
- assert . isOk ( h3 ) ;
48
- assert . isOk ( h3 . textContent ) ;
47
+ assert . isOk ( h3 , 'We need an `h3` element inside `.tagline`.' ) ;
48
+ assert . isOk ( h3 . textContent , 'Our tagline\'s `h3` element cannot be empty.' ) ;
49
49
} ) ;
50
50
51
- it ( 'should have a descriptive paragraph' , ( ) => {
51
+ it ( 'should have a descriptive paragraph @tagline ' , ( ) => {
52
52
const p = doc . querySelector ( '.tagline p' ) ;
53
- assert . isOk ( p ) ;
54
- assert . isOk ( p . textContent ) ;
53
+ assert . isOk ( p , 'We need a `p` element inside `.tagline`.' ) ;
54
+ assert . isOk ( p . textContent , 'Our tagline\'s `p` element cannot be empty.' ) ;
55
55
} ) ;
56
56
} ) ;
57
-
57
+
58
58
59
59
/**
60
60
* SKILLS
61
61
*/
62
62
describe ( 'skills' , ( ) => {
63
- it ( 'should exist' , ( ) => {
63
+ it ( 'should exist @skills ' , ( ) => {
64
64
const skills = doc . querySelector ( '.skills' ) ;
65
- assert . isOk ( skills ) ;
65
+ assert . isOk ( skills , 'We need a `.skills` element.' ) ;
66
66
} ) ;
67
67
68
- it ( 'should have a non-empty h3 tag' , ( ) => {
68
+ it ( 'should have a non-empty h3 tag @skills ' , ( ) => {
69
69
const h3 = doc . querySelector ( '.skills h3' ) ;
70
- assert . isOk ( h3 ) ;
71
- assert . isOk ( h3 . textContent ) ;
70
+ assert . isOk ( h3 , 'We need an `h3` element inside `.skills`.' ) ;
71
+ assert . isOk ( h3 . textContent , 'Our skills\' `h3` element cannot be empty.' ) ;
72
72
} ) ;
73
73
74
- it ( 'should have a descriptive paragraph' , ( ) => {
74
+ it ( 'should have a descriptive paragraph @skills ' , ( ) => {
75
75
const p = doc . querySelector ( '.skills p' ) ;
76
- assert . isOk ( p ) ;
77
- assert . isOk ( p . textContent ) ;
76
+ assert . isOk ( p , 'We need a `p` element inside `.skills`.' ) ;
77
+ assert . isOk ( p . textContent , 'Our skills\' `p` element cannot be empty.' ) ;
78
78
} ) ;
79
79
80
- it ( 'should have an unordered list of your skills' , ( ) => {
80
+ it ( 'should have an unordered list of your skills @skills ' , ( ) => {
81
81
const ul = doc . querySelector ( '.skills ul' ) ;
82
- assert . isOk ( ul ) ;
82
+ assert . isOk ( ul , 'We need a `ul` element inside `.skills`.' ) ;
83
83
} ) ;
84
84
85
- it ( 'should have at least 3 skills' , ( ) => {
85
+ it ( 'should have at least 3 skills @skills ' , ( ) => {
86
86
const skillItems = doc . querySelectorAll ( '.skills ul li' ) ;
87
- assert . isAtLeast ( skillItems . length , 3 ) ;
87
+ assert . isAtLeast ( skillItems . length , 3 , 'We need at least 3 `li` elements inside the skills\' `ul`.' ) ;
88
88
} ) ;
89
89
90
- it ( 'should have one skill that contains HTML' , ( ) => {
90
+ it ( 'should have one skill that contains HTML @skills ' , ( ) => {
91
91
const skillItems = Array . from ( doc . querySelectorAll ( '.skills ul li' ) ) ;
92
92
const htmlRegex = / h t m l / i;
93
93
94
94
const skillsWithHtml = skillItems
95
95
. map ( li => li . textContent )
96
96
. filter ( skill => htmlRegex . test ( skill ) ) ;
97
97
98
- assert . equal ( skillsWithHtml . length , 1 ) ;
98
+ assert . equal ( skillsWithHtml . length , 1 , 'HTML needs be part of one of your skills.' ) ;
99
99
} ) ;
100
100
} ) ;
101
101
@@ -104,28 +104,28 @@ describe('The webpage', () => {
104
104
* CONTACT
105
105
*/
106
106
describe ( 'contact' , ( ) => {
107
- it ( 'should exist' , ( ) => {
107
+ it ( 'should exist @contact ' , ( ) => {
108
108
const contact = doc . querySelector ( '.contact' ) ;
109
- assert . isOk ( contact ) ;
109
+ assert . isOk ( contact , 'We need a `.contact` element.' ) ;
110
110
} ) ;
111
111
112
- it ( 'should have a non-empty h3 tag' , ( ) => {
112
+ it ( 'should have a non-empty h3 tag @contact ' , ( ) => {
113
113
const h3 = doc . querySelector ( '.contact h3' ) ;
114
- assert . isOk ( h3 ) ;
115
- assert . isOk ( h3 . textContent ) ;
114
+ assert . isOk ( h3 , 'We need an `h3` element inside `.contact`.' ) ;
115
+ assert . isOk ( h3 . textContent , 'Our contact\'s `h3` element cannot be empty.' ) ;
116
116
} ) ;
117
117
118
- it ( 'should have a descriptive paragraph' , ( ) => {
118
+ it ( 'should have a descriptive paragraph @contact ' , ( ) => {
119
119
const p = doc . querySelector ( '.contact p' ) ;
120
- assert . isOk ( p ) ;
121
- assert . isOk ( p . textContent ) ;
120
+ assert . isOk ( p , 'We need a `p` element inside `.contact`.' ) ;
121
+ assert . isOk ( p . textContent , 'Our contact\'s `p` element cannot be empty.' ) ;
122
122
} ) ;
123
123
124
- it ( 'should have a link with an href within the paragraph' , ( ) => {
124
+ it ( 'should have a link with an href within the paragraph @contact ' , ( ) => {
125
125
const a = doc . querySelector ( '.contact p a' ) ;
126
- assert . isOk ( a ) ;
127
- assert . isOk ( a . textContent ) ;
128
- assert . isOk ( a . getAttribute ( 'href' ) ) ;
126
+ assert . isOk ( a , 'We need a `a` element our inside contact\'s `p` element.' ) ;
127
+ assert . isOk ( a . textContent , 'Our contact\'s `a` element cannot be empty.' ) ;
128
+ assert . isOk ( a . getAttribute ( 'href' ) , 'Our contact\'s `a` element needs a non-empty `href` attribute.' ) ;
129
129
} ) ;
130
130
} ) ;
131
131
0 commit comments