@@ -96,7 +96,7 @@ describe('Anagram', () => {
9696
9797 xtest ( 'does not detect an anagram if the original word is repeated' , ( ) => {
9898 const expected = [ ] ;
99- const actual = findAnagrams ( 'go' , [ 'go Go GO ' ] ) ;
99+ const actual = findAnagrams ( 'go' , [ 'goGoGO ' ] ) ;
100100 expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
101101 } ) ;
102102
@@ -106,15 +106,39 @@ describe('Anagram', () => {
106106 expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
107107 } ) ;
108108
109- xtest ( 'words are not anagrams of themselves (case-insensitive) ' , ( ) => {
109+ xtest ( 'words are not anagrams of themselves' , ( ) => {
110110 const expected = [ ] ;
111- const actual = findAnagrams ( 'BANANA' , [ 'BANANA' , 'Banana' , 'banana' ] ) ;
111+ const actual = findAnagrams ( 'BANANA' , [ 'BANANA' ] ) ;
112+ expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
113+ } ) ;
114+
115+ xtest ( 'words are not anagrams of themselves even if letter case is partially different' , ( ) => {
116+ const expected = [ ] ;
117+ const actual = findAnagrams ( 'BANANA' , [ 'Banana' ] ) ;
118+ expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
119+ } ) ;
120+
121+ xtest ( 'words are not anagrams of themselves even if letter case is completely different' , ( ) => {
122+ const expected = [ ] ;
123+ const actual = findAnagrams ( 'BANANA' , [ 'banana' ] ) ;
112124 expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
113125 } ) ;
114126
115127 xtest ( 'words other than themselves can be anagrams' , ( ) => {
116128 const expected = [ 'Silent' ] ;
117- const actual = findAnagrams ( 'LISTEN' , [ 'Listen' , 'Silent' , 'LISTEN' ] ) ;
129+ const actual = findAnagrams ( 'LISTEN' , [ 'LISTEN' , 'Silent' ] ) ;
130+ expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
131+ } ) ;
132+
133+ xtest ( 'handles case of greek letters' , ( ) => {
134+ const expected = [ 'ΒΓΑ' , 'γβα' ] ;
135+ const actual = findAnagrams ( 'ΑΒΓ' , [ 'ΒΓΑ' , 'ΒΓΔ' , 'γβα' , 'αβγ' ] ) ;
136+ expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
137+ } ) ;
138+
139+ xtest ( 'different characters may have the same bytes' , ( ) => {
140+ const expected = [ ] ;
141+ const actual = findAnagrams ( 'a⬂' , [ '€a' ] ) ;
118142 expect ( areSetsEqual ( new Set ( expected ) , new Set ( actual ) ) ) . toEqual ( true ) ;
119143 } ) ;
120144} ) ;
0 commit comments