diff --git a/code-push-plugin-testing-framework/script/projectManager.js b/code-push-plugin-testing-framework/script/projectManager.js index 3c4a5b96..25a1d752 100644 --- a/code-push-plugin-testing-framework/script/projectManager.js +++ b/code-push-plugin-testing-framework/script/projectManager.js @@ -38,7 +38,7 @@ var ProjectManager = (function () { * * Overwrite this in your implementation! */ - ProjectManager.prototype.createUpdateArchive = function (projectDirectory, targetPlatform, isDiff) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; + ProjectManager.prototype.createUpdateArchive = function (projectDirectory, targetPlatform) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; /** * Prepares a specific platform for tests. * diff --git a/code-push-plugin-testing-framework/script/testUtil.js b/code-push-plugin-testing-framework/script/testUtil.js index c272d2b9..b2c9b642 100644 --- a/code-push-plugin-testing-framework/script/testUtil.js +++ b/code-push-plugin-testing-framework/script/testUtil.js @@ -125,7 +125,7 @@ var TestUtil = (function () { /** * Archives the contents of sourceFolder and puts it in an archive at archivePath in targetFolder. */ - TestUtil.archiveFolder = function (sourceFolder, targetFolder, archivePath, isDiff) { + TestUtil.archiveFolder = function (sourceFolder, targetFolder, archivePath) { var deferred = Q.defer(); var archive = archiver.create("zip", {}); console.log("Creating an update archive at: " + archivePath); @@ -139,9 +139,6 @@ var TestUtil = (function () { archive.on("error", function (e) { deferred.reject(e); }); - if (isDiff) { - archive.append("{\"deletedFiles\":[]}", { name: "hotcodepush.json" }); - } archive.directory(sourceFolder, targetFolder); archive.pipe(writeStream); archive.finalize(); diff --git a/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts b/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts index f680865f..20d4c591 100644 --- a/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts +++ b/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts @@ -228,7 +228,7 @@ declare module 'code-push-plugin-testing-framework/script/projectManager' { * * Overwrite this in your implementation! */ - createUpdateArchive(projectDirectory: string, targetPlatform: platform.IPlatform, isDiff?: boolean): Q.Promise; + createUpdateArchive(projectDirectory: string, targetPlatform: platform.IPlatform): Q.Promise; /** * Prepares a specific platform for tests. * @@ -474,7 +474,7 @@ declare module 'code-push-plugin-testing-framework/script/testUtil' { /** * Archives the contents of sourceFolder and puts it in an archive at archivePath in targetFolder. */ - static archiveFolder(sourceFolder: string, targetFolder: string, archivePath: string, isDiff: boolean): Q.Promise; + static archiveFolder(sourceFolder: string, targetFolder: string, archivePath: string): Q.Promise; } } diff --git a/test/codesign.mts b/test/codesign.mts index 51fc0928..9af72d4b 100644 --- a/test/codesign.mts +++ b/test/codesign.mts @@ -84,14 +84,7 @@ function signUpdateContentsHash(contentHash: string): string { * Code-signs the update contents with the test key pair and records the real hash, so the mock * server hands back a package_hash that matches what the client's data-integrity check computes. */ -export function signAndRecordUpdateArchive(bundleFolder: string, isDiff: boolean): void { - // TODO(RA-4875): Diff updates clear it instead, since they are poorly implemented in the entire test harness. - // It's going to be a bigger refactor, so for now we just skip signing/hashing to avoid using a stale value in diff tests. - if (isDiff) { - ServerUtil.setKnownPackageHash(undefined); - return; - } - +export function signAndRecordUpdateArchive(bundleFolder: string): void { const contentHash = computeUpdateContentsHash(bundleFolder); const signatureFolder = path.join(bundleFolder, 'CodePush'); fs.mkdirSync(signatureFolder, { recursive: true }); @@ -114,5 +107,5 @@ export async function setupTamperedSignatureUpdateScenario( signUpdateContentsHash(tamperedHash), ); - return await TestUtil.archiveFolder(bundleFolder, '', updatePath, false); + return await TestUtil.archiveFolder(bundleFolder, '', updatePath); } diff --git a/test/test.mts b/test/test.mts index 42c48f43..b3e1ef0a 100644 --- a/test/test.mts +++ b/test/test.mts @@ -758,11 +758,7 @@ class RNProjectManager extends ProjectManager { /** * Creates a CodePush update package zip for a project. */ - public createUpdateArchive( - projectDirectory: string, - targetPlatform: Platform.IPlatform, - isDiff?: boolean, - ): Q.Promise { + public createUpdateArchive(projectDirectory: string, targetPlatform: Platform.IPlatform): Q.Promise { const t0 = Date.now(); const bundleFolder: string = path.join(projectDirectory, TestConfig.TestAppName, 'CodePush/'); const bundleName: string = (targetPlatform as unknown as RNPlatform).getBundleName(); @@ -797,14 +793,13 @@ class RNProjectManager extends ProjectManager { { cwd: path.join(projectDirectory, TestConfig.TestAppName), noLogStdOut: true }, ), ) - .then(() => signAndRecordUpdateArchive(bundleFolder, isDiff)) + .then(() => signAndRecordUpdateArchive(bundleFolder)) .then( TestUtil.archiveFolder.bind( undefined, bundleFolder, '', path.join(projectDirectory, TestConfig.TestAppName, 'update.zip'), - isDiff, ), ) .then((result) => { @@ -825,14 +820,13 @@ class RNProjectManager extends ProjectManager { { cwd: path.join(projectDirectory, TestConfig.TestAppName), noLogStdOut: true }, ), ) - .then(() => signAndRecordUpdateArchive(bundleFolder, isDiff)) + .then(() => signAndRecordUpdateArchive(bundleFolder)) .then( TestUtil.archiveFolder.bind( undefined, bundleFolder, '', path.join(projectDirectory, TestConfig.TestAppName, 'update.zip'), - isDiff, ), ) .then((result) => { @@ -1375,35 +1369,6 @@ PluginTestingFramework.initializeTests( // projectManager.runApplication(TestConfig.testRunDirectory, targetPlatform); // }, false), - TestBuilder.it('localPackage.install.handlesDiff.againstBinary', false, (done: Mocha.Done) => { - ServerUtil.updateResponse = { update_info: ServerUtil.createUpdateResponse(false, targetPlatform) }; - - /* create an update */ - setupUpdateScenario(projectManager, targetPlatform, UpdateNotifyApplicationReady, 'Diff Update 1') - .then((updatePath: string) => { - ServerUtil.updatePackagePath = updatePath; - projectManager.runApplication(TestConfig.testRunDirectory, targetPlatform); - return ServerUtil.expectTestMessages([ - ServerUtil.TestMessage.CHECK_UPDATE_AVAILABLE, - ServerUtil.TestMessage.DOWNLOAD_SUCCEEDED, - ServerUtil.TestMessage.DEVICE_READY_AFTER_UPDATE, - ]); - }) - .then(() => { - /* run the app again to ensure it was not reverted */ - targetPlatform.getEmulatorManager().restartApplication(TestConfig.TestNamespace); - return ServerUtil.expectTestMessages([ServerUtil.TestMessage.DEVICE_READY_AFTER_UPDATE]); - }) - .done( - () => { - done(); - }, - (e) => { - done(e); - }, - ); - }); - TestBuilder.it('localPackage.install.immediately', false, (done: Mocha.Done) => { ServerUtil.updateResponse = { update_info: ServerUtil.createUpdateResponse(false, targetPlatform) };