Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function checkLinuxResult(outDir: string, packager: Packager, arch: Arch, nameToTarget: Map) {
if (!nameToTarget.has("deb")) {
return
}
const appInfo = packager.appInfo
const packageFile = `${outDir}/TestApp_${appInfo.version}_${arch === Arch.ia32 ? "i386" : (arch === Arch.x64 ? "amd64" : "armv7l")}.deb`
expect(await getContents(packageFile)).toMatchSnapshot()
if (arch === Arch.ia32) {
expect(await getContents(`${outDir}/TestApp_${appInfo.version}_i386.deb`)).toMatchSnapshot()
}
const control = parseDebControl(await execShell(`ar p '${packageFile}' control.tar.gz | ${await getTarExecutable()} zx --to-stdout ./control`, {
maxBuffer: 10 * 1024 * 1024,
}))
delete control.Version
delete control.Size
const description = control.Description
delete control.Description
expect(control).toMatchSnapshot()
// strange difference on linux and mac (no leading space on Linux)
expect(description.trim()).toMatchSnapshot()
}
export async function expectUpdateMetadata(context: PackedContext, arch: Arch = Arch.ia32, requireCodeSign: boolean = false): Promise {
const data = safeLoad(await fs.readFile(path.join(context.getResources(Platform.WINDOWS, arch), "app-update.yml"), "utf-8")) as any
if (requireCodeSign) {
expect(data.publisherName).toEqual(["Foo, Inc"])
delete data.publisherName
}
expect(data).toMatchSnapshot()
}