Rename test case file

This commit is contained in:
Joseph Garrone
2024-01-30 00:10:59 +01:00
parent 5b350274bd
commit f55d61bf0b
2 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../constants"; import { nameOfTheGlobal, basenameOfTheKeycloakifyResourcesDir } from "../../../constants";
import { assert } from "tsafe/assert"; import { assert } from "tsafe/assert";
import type { BuildOptions } from "../../BuildOptions"; import type { BuildOptions } from "../../BuildOptions";
import { relative as pathRelative, sep as pathSep } from "path"; import * as nodePath from "path";
import { replaceAll } from "../../../tools/String.prototype.replaceAll"; import { replaceAll } from "../../../tools/String.prototype.replaceAll";
export type BuildOptionsLike = { export type BuildOptionsLike = {
@ -12,8 +12,12 @@ export type BuildOptionsLike = {
assert<BuildOptions extends BuildOptionsLike ? true : false>(); assert<BuildOptions extends BuildOptionsLike ? true : false>();
export function replaceImportsInJsCode_webpack(params: { jsCode: string; buildOptions: BuildOptionsLike }): { fixedJsCode: string } { export function replaceImportsInJsCode_webpack(params: { jsCode: string; buildOptions: BuildOptionsLike; systemType?: "posix" | "win32" }): {
const { jsCode, buildOptions } = params; fixedJsCode: string;
} {
const { jsCode, buildOptions, systemType = nodePath.sep === "/" ? "posix" : "win32" } = params;
const { relative: pathRelative, sep: pathSep } = nodePath[systemType];
let fixedJsCode = jsCode; let fixedJsCode = jsCode;

View File

@ -6,7 +6,7 @@ import { expect, it, describe } from "vitest";
import { isSameCode } from "../tools/isSameCode"; import { isSameCode } from "../tools/isSameCode";
import { basenameOfTheKeycloakifyResourcesDir, nameOfTheGlobal } from "keycloakify/bin/constants"; import { basenameOfTheKeycloakifyResourcesDir, nameOfTheGlobal } from "keycloakify/bin/constants";
describe("bin/js-transforms - vite", () => { describe("js replacer - vite", () => {
it("replaceImportsInJsCode_vite - 1", () => { it("replaceImportsInJsCode_vite - 1", () => {
const before = `Uv="modulepreload",`; const before = `Uv="modulepreload",`;
const after = `,Wc={},`; const after = `,Wc={},`;
@ -207,7 +207,7 @@ describe("bin/js-transforms - vite", () => {
}); });
}); });
describe("bin/js-transforms - webpack", () => { describe("js replacer - webpack", () => {
const jsCodeUntransformed = ` const jsCodeUntransformed = `
function f() { function f() {
return a.p+"static/js/" + ({}[e] || e) + "." + { return a.p+"static/js/" + ({}[e] || e) + "." + {
@ -317,7 +317,7 @@ describe("bin/js-transforms - webpack", () => {
}); });
}); });
describe("bin/css-transforms", () => { describe("css replacer", () => {
it("transforms absolute urls to css globals properly with no urlPathname", () => { it("transforms absolute urls to css globals properly with no urlPathname", () => {
const { fixedCssCode, cssGlobalsToDefine } = replaceImportsInCssCode({ const { fixedCssCode, cssGlobalsToDefine } = replaceImportsInCssCode({
"cssCode": ` "cssCode": `
@ -432,7 +432,7 @@ describe("bin/css-transforms", () => {
}); });
}); });
describe("bin/css-inline-transforms", () => { describe("inline css replacer", () => {
describe("no url pathName", () => { describe("no url pathName", () => {
const cssCode = ` const cssCode = `
@font-face { @font-face {