Rearenge test case
This commit is contained in:
parent
f55d61bf0b
commit
1eb6b154f7
@ -1,4 +1,5 @@
|
|||||||
import { replaceImportsInJsCode_vite } from "keycloakify/bin/keycloakify/replacers/replaceImportsInJsCode/vite";
|
import { replaceImportsInJsCode_vite } from "keycloakify/bin/keycloakify/replacers/replaceImportsInJsCode/vite";
|
||||||
|
import { replaceImportsInJsCode_webpack } from "keycloakify/bin/keycloakify/replacers/replaceImportsInJsCode/webpack";
|
||||||
import { generateCssCodeToDefineGlobals, replaceImportsInCssCode } from "keycloakify/bin/keycloakify/replacers/replaceImportsInCssCode";
|
import { generateCssCodeToDefineGlobals, replaceImportsInCssCode } from "keycloakify/bin/keycloakify/replacers/replaceImportsInCssCode";
|
||||||
import { replaceImportsInInlineCssCode } from "keycloakify/bin/keycloakify/replacers/replaceImportsInInlineCssCode";
|
import { replaceImportsInInlineCssCode } from "keycloakify/bin/keycloakify/replacers/replaceImportsInInlineCssCode";
|
||||||
import { same } from "evt/tools/inDepth/same";
|
import { same } from "evt/tools/inDepth/same";
|
||||||
@ -208,40 +209,45 @@ describe("js replacer - vite", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("js replacer - webpack", () => {
|
describe("js replacer - webpack", () => {
|
||||||
const jsCodeUntransformed = `
|
it("replaceImportsInJsCode_webpack - 1", () => {
|
||||||
function f() {
|
const jsCodeUntransformed = `
|
||||||
return a.p+"static/js/" + ({}[e] || e) + "." + {
|
function f() {
|
||||||
3: "0664cdc0"
|
return a.p+"static/js/" + ({}[e] || e) + "." + {
|
||||||
}[e] + ".chunk.js"
|
3: "0664cdc0"
|
||||||
}
|
}[e] + ".chunk.js"
|
||||||
|
}
|
||||||
|
|
||||||
function sameAsF() {
|
function sameAsF() {
|
||||||
return a.p+"static/js/" + ({}[e] || e) + "." + {
|
return a.p+"static/js/" + ({}[e] || e) + "." + {
|
||||||
3: "0664cdc0"
|
3: "0664cdc0"
|
||||||
}[e] + ".chunk.js"
|
}[e] + ".chunk.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
__webpack_require__.u=function(e){return"static/js/" + e + "." + {
|
__webpack_require__.u=function(e){return"static/js/" + e + "." + {
|
||||||
147: "6c5cee76",
|
147: "6c5cee76",
|
||||||
787: "8da10fcf",
|
787: "8da10fcf",
|
||||||
922: "be170a73"
|
922: "be170a73"
|
||||||
} [e] + ".chunk.js"
|
} [e] + ".chunk.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
t.miniCssF=function(e){return"static/css/"+e+"."+{
|
t.miniCssF=function(e){return"static/css/"+e+"."+{
|
||||||
164:"dcfd7749",
|
164:"dcfd7749",
|
||||||
908:"67c9ed2c"
|
908:"67c9ed2c"
|
||||||
}[e]+".chunk.css"
|
}[e]+".chunk.css"
|
||||||
}
|
}
|
||||||
|
|
||||||
n.u=e=>"static/js/"+e+"."+{69:"4f205f87",128:"49264537",453:"b2fed72e",482:"f0106901"}[e]+".chunk.js"
|
n.u=e=>"static/js/"+e+"."+{69:"4f205f87",128:"49264537",453:"b2fed72e",482:"f0106901"}[e]+".chunk.js"
|
||||||
|
|
||||||
t.miniCssF=e=>"static/css/"+e+"."+{164:"dcfd7749",908:"67c9ed2c"}[e]+".chunk.css"
|
t.miniCssF=e=>"static/css/"+e+"."+{164:"dcfd7749",908:"67c9ed2c"}[e]+".chunk.css"
|
||||||
`;
|
`;
|
||||||
it("Correctly replace import path in Webpack build/static/js/xxx.js files", () => {
|
|
||||||
const { fixedJsCode } = replaceImportsFromStaticInJsCode({
|
const { fixedJsCode } = replaceImportsInJsCode_webpack({
|
||||||
"jsCode": jsCodeUntransformed,
|
"jsCode": jsCodeUntransformed,
|
||||||
"bundler": "webpack"
|
"buildOptions": {
|
||||||
|
"reactAppBuildDirPath": "/Users/someone/github/keycloakify-starter/build",
|
||||||
|
"assetsDirPath": "/Users/someone/github/keycloakify-starter/dist/build/static",
|
||||||
|
"urlPathname": undefined
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const fixedJsCodeExpected = `
|
const fixedJsCodeExpected = `
|
||||||
|
Loading…
x
Reference in New Issue
Block a user