@@ -46,11 +46,87 @@ describe('sourcemaps', () => {
46
46
it ( 'returns a correctly formatted url' , ( ) => {
47
47
expect ( getSourceMappingUrlLinker ( 'some-pkg' ) ) . toBe ( '//# sourceMappingURL=some-pkg' ) ;
48
48
} ) ;
49
+
50
+ it ( 'handles question marks in URLs' , ( ) => {
51
+ expect ( getSourceMappingUrlLinker ( 'some-pkg?' ) ) . toBe ( '//# sourceMappingURL=some-pkg%3F' ) ;
52
+ } ) ;
53
+
54
+ it ( 'handles equal signs in URLs' , ( ) => {
55
+ expect ( getSourceMappingUrlLinker ( 'some-pkg=' ) ) . toBe ( '//# sourceMappingURL=some-pkg%3D' ) ;
56
+ } ) ;
57
+
58
+ it ( 'handles ampersands in URLs' , ( ) => {
59
+ expect ( getSourceMappingUrlLinker ( 'some-pkg&' ) ) . toBe ( '//# sourceMappingURL=some-pkg%26' ) ;
60
+ } ) ;
61
+
62
+ it ( 'handles slashes in URLs' , ( ) => {
63
+ expect ( getSourceMappingUrlLinker ( 'some-pkg/' ) ) . toBe ( '//# sourceMappingURL=some-pkg%2F' ) ;
64
+ } ) ;
65
+
66
+ it ( 'handles exclamation points in URLs' , ( ) => {
67
+ expect ( getSourceMappingUrlLinker ( 'some-pkg!' ) ) . toBe ( '//# sourceMappingURL=some-pkg%21' ) ;
68
+ } ) ;
69
+
70
+ it ( 'handles single quotes in URLs' , ( ) => {
71
+ expect ( getSourceMappingUrlLinker ( "some-'pkg'" ) ) . toBe ( '//# sourceMappingURL=some-%27pkg%27' ) ;
72
+ } ) ;
73
+
74
+ it ( 'handles parenthesis in URLs' , ( ) => {
75
+ expect ( getSourceMappingUrlLinker ( 'some-(pkg)' ) ) . toBe ( '//# sourceMappingURL=some-%28pkg%29' ) ;
76
+ } ) ;
77
+
78
+ it ( 'handles asterisks in URLs' , ( ) => {
79
+ expect ( getSourceMappingUrlLinker ( 'some-pkg*' ) ) . toBe ( '//# sourceMappingURL=some-pkg%2a' ) ;
80
+ } ) ;
81
+
82
+ it ( 'encodes multiple disallowed characters at once' , ( ) => {
83
+ expect ( getSourceMappingUrlLinker ( '!some-(pkg)*' ) ) . toBe ( '//# sourceMappingURL=%21some-%28pkg%29%2a' ) ;
84
+ } ) ;
49
85
} ) ;
50
86
51
87
describe ( 'getSourceMappingUrlLinkerWithNewline' , ( ) => {
52
88
it ( 'returns a correctly formatted url' , ( ) => {
53
89
expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg.map' ) ;
54
90
} ) ;
91
+
92
+ it ( 'returns a correctly formatted url' , ( ) => {
93
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg.map' ) ;
94
+ } ) ;
95
+
96
+ it ( 'handles question marks in URLs' , ( ) => {
97
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg?' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%3F.map' ) ;
98
+ } ) ;
99
+
100
+ it ( 'handles equal signs in URLs' , ( ) => {
101
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg=' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%3D.map' ) ;
102
+ } ) ;
103
+
104
+ it ( 'handles ampersands in URLs' , ( ) => {
105
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg&' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%26.map' ) ;
106
+ } ) ;
107
+
108
+ it ( 'handles slashes in URLs' , ( ) => {
109
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg/' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%2F.map' ) ;
110
+ } ) ;
111
+
112
+ it ( 'handles exclamation points in URLs' , ( ) => {
113
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg!' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%21.map' ) ;
114
+ } ) ;
115
+
116
+ it ( 'handles single quotes in URLs' , ( ) => {
117
+ expect ( getSourceMappingUrlForEndOfFile ( "some-'pkg'" ) ) . toBe ( '\n//# sourceMappingURL=some-%27pkg%27.map' ) ;
118
+ } ) ;
119
+
120
+ it ( 'handles parenthesis in URLs' , ( ) => {
121
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-(pkg)' ) ) . toBe ( '\n//# sourceMappingURL=some-%28pkg%29.map' ) ;
122
+ } ) ;
123
+
124
+ it ( 'handles asterisks in URLs' , ( ) => {
125
+ expect ( getSourceMappingUrlForEndOfFile ( 'some-pkg*' ) ) . toBe ( '\n//# sourceMappingURL=some-pkg%2a.map' ) ;
126
+ } ) ;
127
+
128
+ it ( 'encodes multiple disallowed characters at once' , ( ) => {
129
+ expect ( getSourceMappingUrlForEndOfFile ( '!some-(pkg)*' ) ) . toBe ( '\n//# sourceMappingURL=%21some-%28pkg%29%2a.map' ) ;
130
+ } ) ;
55
131
} ) ;
56
132
} ) ;
0 commit comments