@@ -7,6 +7,10 @@ describe('search', () => {
77 expect ( search ( '100' ) ) . toEqual ( [ { emoji : '💯' , name : '100' } ] )
88 } )
99
10+ it ( 'returns a single pair when given one-of emoji name as regular expression' , ( ) => {
11+ expect ( search ( / 1 0 0 / ) ) . toEqual ( [ { emoji : '💯' , name : '100' } ] )
12+ } )
13+
1014 it ( 'returns multiple emojis when given a common substring' , ( ) => {
1115 expect ( search ( 'cartwheel' ) ) . toEqual ( [
1216 {
@@ -20,6 +24,19 @@ describe('search', () => {
2024 ] )
2125 } )
2226
27+ it ( 'returns multiple emojis when given a common regular expression' , ( ) => {
28+ expect ( search ( / c a r t w h e e l / ) ) . toEqual ( [
29+ {
30+ emoji : '🤸♀️' ,
31+ name : 'woman_cartwheeling' ,
32+ } ,
33+ {
34+ emoji : '🤸♂️' ,
35+ name : 'man_cartwheeling' ,
36+ } ,
37+ ] )
38+ } )
39+
2340 it ( 'should match when you include the colon' , ( ) => {
2441 expect ( search ( ':cartwheel:' ) ) . toEqual ( [
2542 {
@@ -33,7 +50,24 @@ describe('search', () => {
3350 ] )
3451 } )
3552
36- it ( 'returns an empty array when no matching emojis are found' , ( ) => {
53+ it ( 'should match when you include the colon in the regular expression' , ( ) => {
54+ expect ( search ( / : c a r t w h e e l : / ) ) . toEqual ( [
55+ {
56+ emoji : '🤸♀️' ,
57+ name : 'woman_cartwheeling' ,
58+ } ,
59+ {
60+ emoji : '🤸♂️' ,
61+ name : 'man_cartwheeling' ,
62+ } ,
63+ ] )
64+ } )
65+
66+ it ( 'returns an empty array when no matching emojis are found for a string search' , ( ) => {
3767 expect ( search ( 'notAnEmoji' ) ) . toEqual ( [ ] )
3868 } )
69+
70+ it ( 'returns an empty array when no matching emojis are found for a regular expression search' , ( ) => {
71+ expect ( search ( / n o t A n E m o j i / ) ) . toEqual ( [ ] )
72+ } )
3973} )
0 commit comments