File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ const chai = require ( "chai" ) ;
4+ const chaiSubset = require ( "chai-subset" ) ;
5+ chai . use ( chaiSubset ) ;
6+ const { expect } = chai ;
7+ const $url = require ( "../../../lib/util/url" ) ;
8+
9+ describe ( "Return the extension of a URL" , ( ) => {
10+ it ( "should return an empty string if there isn't any extension" , async ( ) => {
11+ const extension = $url . getExtension ( "/file" ) ;
12+ expect ( extension ) . to . equal ( "" ) ;
13+ } ) ;
14+
15+ it ( "should return the extension in lowercase" , async ( ) => {
16+ const extension = $url . getExtension ( "/file.YML" ) ;
17+ expect ( extension ) . to . equal ( ".yml" ) ;
18+ } ) ;
19+
20+ it ( "should return the extension without the query" , async ( ) => {
21+ const extension = $url . getExtension ( "/file.yml?foo=bar" ) ;
22+ expect ( extension ) . to . equal ( ".yml" ) ;
23+ } ) ;
24+ } ) ;
You can’t perform that action at this time.
0 commit comments