From 9f8cd1f8787372421fc934228963f171187c8077 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Tue, 30 Jul 2024 13:05:22 -0700 Subject: [PATCH] add -ver integration test --- test/integration.js | 21 +++++++++++++++++++++ test/path-exists.js | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 test/integration.js diff --git a/test/integration.js b/test/integration.js new file mode 100644 index 0000000..37912ec --- /dev/null +++ b/test/integration.js @@ -0,0 +1,21 @@ +const fs = require("node:fs"); +const cp = require("node:child_process"); +const assert = require("node:assert"); + +describe("spawned exiftool", () => { + it("-ver", () => { + const path = require(".."); + const child = cp.spawnSync(path, ["-ver"]); + const ver = child.stdout.toString().trim(); + console.log({ version: ver }); + assert( + /^\d\d\.\d\d$/.test(ver), + "version is expected to be MAJOR.MINOR but was " + JSON.stringify(ver), + ); + const stderr = child.stderr.toString(); + assert( + stderr === "", + "stderr is expected to be empty but was " + JSON.stringify(stderr), + ); + }); +}); diff --git a/test/path-exists.js b/test/path-exists.js index c4e8c4a..031d403 100644 --- a/test/path-exists.js +++ b/test/path-exists.js @@ -1,5 +1,5 @@ -const fs = require("fs"); -var assert = require("assert"); +const fs = require("node:fs"); +const assert = require("node:assert"); describe("exported path", () => { it("is a valid path to a file", () => {