Skip to content

Commit

Permalink
test: verify symlinks are created for macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Dec 12, 2023
1 parent 593483d commit 6ff678c
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
Empty file removed test/fixture/cacheDir/nw
Empty file.
88 changes: 88 additions & 0 deletions test/get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import assert from "node:assert";
import fsm from "node:fs/promises";
import path from "node:path";

import { describe, it } from "node:test";

import get from "../src/get.js";

describe("get mode", function () {
it("decompresses file and preserves symlinks on macos", async () => {
const options = {
version: "0.82.0",
flavor: "sdk",
platform: "osx",
arch: "x64",
downloadUrl: "https://dl.nwjs.io",
cacheDir: "./test/fixture/cache",
cache: true,
ffmpeg: false,
nativeAddon: false,
};

await get(options);

const nwDir = path.resolve(
options.cacheDir,
`nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`,
);

const helpersPath = await fsm.stat(
path.resolve(
nwDir,
"nwjs.app",
"Contents",
"Frameworks",
"nwjs Framework.framework",
"Helpers"
)
);
const librariesPath = await fsm.stat(
path.resolve(
nwDir,
"nwjs.app",
"Contents",
"Frameworks",
"nwjs Framework.framework",
"Libraries"
)
);
const frameworkPath = await fsm.stat(
path.resolve(
nwDir,
"nwjs.app",
"Contents",
"Frameworks",
"nwjs Framework.framework",
"nwjs Framework"
)
);
const resourcesPath = await fsm.stat(
path.resolve(
nwDir,
"nwjs.app",
"Contents",
"Frameworks",
"nwjs Framework.framework",
"Resources"
)
);
const versionCurrentPath = await fsm.stat(
path.resolve(
nwDir,
"nwjs.app",
"Contents",
"Frameworks",
"nwjs Framework.framework",
"Versions",
"Current"
)
);

assert.strictEqual(helpersPath.isSymbolicLink(), true);
assert.strictEqual(librariesPath.isSymbolicLink(), true);
assert.strictEqual(frameworkPath.isSymbolicLink(), true);
assert.strictEqual(resourcesPath.isSymbolicLink(), true);
assert.strictEqual(versionCurrentPath.isSymbolicLink(), true);
});
});
6 changes: 4 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// import * as addonTests from "./addon.js";
import * as modeTests from "./mode.js";
import * as getTests from "./get.js";
// import * as modeTests from "./mode.js";

// addonTests;
modeTests;
getTests;
// modeTests;

0 comments on commit 6ff678c

Please sign in to comment.