File tree Expand file tree Collapse file tree 2 files changed +29
-27
lines changed
Expand file tree Collapse file tree 2 files changed +29
-27
lines changed Original file line number Diff line number Diff line change 11import { describe , expect , it } from 'vitest'
2- import { decodeHtmlEntities , toIsoDateString } from '../../../../app/utils/formatters'
2+ import { toIsoDateString } from '../../../../app/utils/formatters'
33
44describe ( 'toIsoDateString' , ( ) => {
55 it ( 'formats a date as YYYY-MM-DD' , ( ) => {
@@ -10,29 +10,3 @@ describe('toIsoDateString', () => {
1010 expect ( toIsoDateString ( new Date ( '2024-01-05T00:00:00Z' ) ) ) . toBe ( '2024-01-05' )
1111 } )
1212} )
13-
14- describe ( 'decodeHtmlEntities' , ( ) => {
15- it . each ( [
16- [ '&' , '&' ] ,
17- [ '<' , '<' ] ,
18- [ '>' , '>' ] ,
19- [ '"' , '"' ] ,
20- [ ''' , "'" ] ,
21- [ ''' , "'" ] ,
22- [ ' ' , ' ' ] ,
23- ] as const ) ( '%s → %s' , ( input , expected ) => {
24- expect ( decodeHtmlEntities ( input ) ) . toBe ( expected )
25- } )
26-
27- it ( 'decodes multiple entities in one string' , ( ) => {
28- expect ( decodeHtmlEntities ( 'a & b < c' ) ) . toBe ( 'a & b < c' )
29- } )
30-
31- it ( 'leaves plain text unchanged' , ( ) => {
32- expect ( decodeHtmlEntities ( 'say no to bloat' ) ) . toBe ( 'say no to bloat' )
33- } )
34-
35- it ( 'leaves unknown entities unchanged' , ( ) => {
36- expect ( decodeHtmlEntities ( '&unknown;' ) ) . toBe ( '&unknown;' )
37- } )
38- } )
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest'
2+ import { decodeHtmlEntities } from '../../../../shared/utils/html'
3+
4+ describe ( 'decodeHtmlEntities' , ( ) => {
5+ it . each ( [
6+ [ '&' , '&' ] ,
7+ [ '<' , '<' ] ,
8+ [ '>' , '>' ] ,
9+ [ '"' , '"' ] ,
10+ [ ''' , "'" ] ,
11+ [ ''' , "'" ] ,
12+ [ ' ' , ' ' ] ,
13+ ] as const ) ( '%s → %s' , ( input , expected ) => {
14+ expect ( decodeHtmlEntities ( input ) ) . toBe ( expected )
15+ } )
16+
17+ it ( 'decodes multiple entities in one string' , ( ) => {
18+ expect ( decodeHtmlEntities ( 'a & b < c' ) ) . toBe ( 'a & b < c' )
19+ } )
20+
21+ it ( 'leaves plain text unchanged' , ( ) => {
22+ expect ( decodeHtmlEntities ( 'say no to bloat' ) ) . toBe ( 'say no to bloat' )
23+ } )
24+
25+ it ( 'leaves unknown entities unchanged' , ( ) => {
26+ expect ( decodeHtmlEntities ( '&unknown;' ) ) . toBe ( '&unknown;' )
27+ } )
28+ } )
You can’t perform that action at this time.
0 commit comments