2022-02-28 20:27:56 +00:00
|
|
|
import { strict as assert } from "assert";
|
2023-04-24 10:27:03 +00:00
|
|
|
import { swfFileName } from "../src/swf-utils";
|
2022-02-28 20:27:56 +00:00
|
|
|
|
|
|
|
describe("swfFileName", function () {
|
|
|
|
it("should extract simple SWF name", function () {
|
|
|
|
assert.deepEqual(nameFor("http://example.com/file.swf"), "file.swf");
|
|
|
|
});
|
|
|
|
it("should not include query parameters", function () {
|
|
|
|
assert.deepEqual(
|
|
|
|
nameFor(
|
2023-07-20 11:19:39 +00:00
|
|
|
"https://uploads.ungrounded.net/574000/574241_DiamondNGSP.swf?123",
|
2022-02-28 20:27:56 +00:00
|
|
|
),
|
2023-07-20 11:19:39 +00:00
|
|
|
"574241_DiamondNGSP.swf",
|
2022-02-28 20:27:56 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function nameFor(url: string): string {
|
|
|
|
return swfFileName(new URL(url));
|
|
|
|
}
|