Merge develop
This commit is contained in:
commit
29f6716fa9
209 changed files with 8475 additions and 4933 deletions
|
@ -53,7 +53,7 @@ export default class ActorsSpec extends T {
|
|||
[
|
||||
"download latest version",
|
||||
() => {
|
||||
const state = new UserRelatedState(new LayoutConfig(bookcaseJson, true, "tests"))
|
||||
const state = new UserRelatedState(new LayoutConfig(<any> bookcaseJson, true, "tests"))
|
||||
const feature = {
|
||||
"type": "Feature",
|
||||
"id": "node/5568693115",
|
||||
|
|
35
test/CodeQuality.spec.ts
Normal file
35
test/CodeQuality.spec.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import T from "./TestHelper";
|
||||
import {exec} from "child_process";
|
||||
|
||||
export default class CodeQualitySpec extends T {
|
||||
constructor() {
|
||||
super([
|
||||
[
|
||||
"no constructor.name in compiled code", () => {
|
||||
|
||||
const excludedDirs = [".git", "node_modules", "dist", ".cache", ".parcel-cache", "assets"]
|
||||
|
||||
exec("grep \"constructor.name\" -r . " + excludedDirs.map(d => "--exclude-dir=" + d).join(" "), ((error, stdout, stderr) => {
|
||||
if (error?.message?.startsWith("Command failed: grep")) {
|
||||
return;
|
||||
}
|
||||
if (error !== null) {
|
||||
throw error
|
||||
|
||||
}
|
||||
if (stderr !== "") {
|
||||
throw stderr
|
||||
}
|
||||
|
||||
const found = stdout.split("\n").filter(s => s !== "").filter(s => s.startsWith("test/"));
|
||||
if (found.length > 0) {
|
||||
throw "Found a 'constructor.name' at " + found.join(", ") + ". This is not allowed, as minification does erase names."
|
||||
}
|
||||
|
||||
}))
|
||||
|
||||
}
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
53
test/CreateCache.spec.ts
Normal file
53
test/CreateCache.spec.ts
Normal file
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@ export default class ImageAttributionSpec extends T {
|
|||
[
|
||||
"Should find all the images",
|
||||
() => {
|
||||
const images = new Set(new ExtractImages().convertStrict(cyclofix, "test"))
|
||||
const images = new Set(new ExtractImages().convertStrict(<any> cyclofix, "test"))
|
||||
const expectedValues = [
|
||||
'./assets/layers/bike_repair_station/repair_station.svg',
|
||||
'./assets/layers/bike_repair_station/repair_station_pump.svg',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default class OsmConnectionSpec extends T {
|
|||
() => {
|
||||
const osmConn = new OsmConnection({
|
||||
osmConfiguration: "osm-test",
|
||||
layoutName: "Unit test",
|
||||
allElements: new ElementStorage(),
|
||||
changes: new Changes(),
|
||||
oauth_token: new UIEventSource<string>(OsmConnectionSpec._osm_token)
|
||||
|
|
|
@ -17,13 +17,13 @@ import ReplaceGeometrySpec from "./ReplaceGeometry.spec";
|
|||
import LegacyThemeLoaderSpec from "./LegacyThemeLoader.spec";
|
||||
import T from "./TestHelper";
|
||||
import CreateNoteImportLayerSpec from "./CreateNoteImportLayer.spec";
|
||||
import ValidatedTextFieldTranslations from "./ValidatedTextFieldTranslations.spec";
|
||||
import ValidatedTextFieldTranslationsSpec from "./ValidatedTextFieldTranslations.spec";
|
||||
import CreateCacheSpec from "./CreateCache.spec";
|
||||
import CodeQualitySpec from "./CodeQuality.spec";
|
||||
|
||||
|
||||
async function main() {
|
||||
|
||||
ScriptUtils.fixUtils()
|
||||
const allTests: T[] = [
|
||||
new OsmObjectSpec(),
|
||||
new TagSpec(),
|
||||
|
@ -41,12 +41,16 @@ async function main() {
|
|||
new ReplaceGeometrySpec(),
|
||||
new LegacyThemeLoaderSpec(),
|
||||
new CreateNoteImportLayerSpec(),
|
||||
new ValidatedTextFieldTranslationsSpec()
|
||||
new ValidatedTextFieldTranslationsSpec(),
|
||||
new CreateCacheSpec(),
|
||||
new CodeQualitySpec()
|
||||
]
|
||||
ScriptUtils.fixUtils();
|
||||
const realDownloadFunc = Utils.externalDownloadFunction;
|
||||
|
||||
Utils.externalDownloadFunction = async (url) => {
|
||||
console.error("Fetching ", url, "blocked in tests, use Utils.injectJsonDownloadForTests")
|
||||
const data = await ScriptUtils.DownloadJSON(url)
|
||||
const data = await realDownloadFunc(url)
|
||||
console.log("\n\n ----------- \nBLOCKED DATA\n Utils.injectJsonDownloadForTests(\n" +
|
||||
" ", JSON.stringify(url), ", \n",
|
||||
" ", JSON.stringify(data), "\n )\n------------------\n\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue