Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Tweak

Manav Rathiad1245877471
diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.ts
index 5707634715..b9f77682ed 100644
--- a/web/apps/photos/tests/upload.test.ts
+++ b/web/apps/photos/tests/upload.test.ts
@@ -137,14 +137,14 @@ export async function testUpload() {
const jsonString = process.env.NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON;
if (!jsonString) {
- throw Error(
- "Please specify the NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON to run the upload tests",
+ console.warn(
+ "Not running upload tests. Please specify the NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON to run the upload tests",
);
+ return;
}
+
const expectedState = JSON.parse(jsonString);
- if (!expectedState) {
- throw Error("upload test failed expectedState missing");
- }
+ if (!expectedState) throw Error("Invalid JSON");
try {
await totalCollectionCountCheck(expectedState);
@@ -426,28 +426,26 @@ function parseDateTimeFromFileNameTest() {
}
const fileNameToJSONMappingTests = () => {
- fileNameToJSONMappingCases.forEach(({ filename, jsonFilename }) => {
+ for (const { filename, jsonFilename } of fileNameToJSONMappingCases) {
const jsonKey = metadataJSONMapKeyForJSON(0, jsonFilename);
// This duplicates somewhat the logic in takeout.ts:matchTakeoutMetadata()
const components = getFileNameComponents(filename);
let fileKey = getMetadataJSONMapKeyForFile(0, components);
- if (fileKey !== jsonKey) {
+ if (fileKey != jsonKey) {
fileKey = getClippedMetadataJSONMapKeyForFile(0, components);
}
- if (fileKey !== jsonKey) {
+ if (fileKey != jsonKey) {
fileKey = getSupplementaryMetadataJSONMapKeyForFile(0, components);
}
- if (fileKey !== jsonKey) {
+ if (fileKey != jsonKey) {
throw Error(
- `mappingFileAndJSONFileCheck failed ❌ ,
- for ${filename}
- expected: ${jsonKey} got: ${fileKey}`,
+ `fileNameToJSONMappingTests failed ❌ for ${filename} (expected: ${jsonKey} got: ${fileKey})`,
);
}
- });
- console.log("mappingFileAndJSONFileCheck passed βœ…");
+ }
+ console.log("fileNameToJSONMappingTests passed βœ…");
};
// format: YYYY-MM-DD HH:MM:SS