File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { assert } from 'chai' ;
2+
3+ import { unescape } from '../src/index.js' ;
4+
5+ describe ( 'unescape' , function ( ) {
6+ it ( 'should replace "~1" with "/"' , function ( ) {
7+ assert . strictEqual ( unescape ( 'foo~1bar' ) , 'foo/bar' ) ;
8+ } ) ;
9+
10+ it ( 'should replace "~0" with "~"' , function ( ) {
11+ assert . strictEqual ( unescape ( 'foo~0bar' ) , 'foo~bar' ) ;
12+ } ) ;
13+
14+ it ( 'should replace both "~1" and "~0" correctly' , function ( ) {
15+ assert . strictEqual ( unescape ( 'foo~1bar~0baz' ) , 'foo/bar~baz' ) ;
16+ } ) ;
17+
18+ it ( 'should handle multiple occurrences of "~1" and "~0"' , function ( ) {
19+ assert . strictEqual ( unescape ( '~1foo~0bar~1baz~0qux' ) , '/foo~bar/baz~qux' ) ;
20+ } ) ;
21+
22+ it ( 'should return the same string if there are no "~1" or "~0" sequences' , function ( ) {
23+ assert . strictEqual ( unescape ( 'foobar' ) , 'foobar' ) ;
24+ } ) ;
25+
26+ it ( 'should handle an empty string correctly' , function ( ) {
27+ assert . strictEqual ( unescape ( '' ) , '' ) ;
28+ } ) ;
29+
30+ it ( 'should not modify unrelated characters' , function ( ) {
31+ assert . strictEqual ( unescape ( 'foo-bar_baz~9' ) , 'foo-bar_baz~9' ) ;
32+ } ) ;
33+ } ) ;
You can’t perform that action at this time.
0 commit comments