Skip to content

Commit 27d3364

Browse files
committed
add tests for getExtension
1 parent 4491e47 commit 27d3364

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/specs/util/url.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
});

0 commit comments

Comments
 (0)