Skip to content

Commit b92379f

Browse files
author
Leah Restad
committed
prepublish fixes
1 parent 552ee7a commit b92379f

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/test-nodejs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ jobs:
4747
- name: Run functional tests
4848
working-directory: nodejs
4949
run: npm run test:functional
50+
51+
- name: Run pre-publish tests
52+
working-directory: nodejs
53+
run: npm run build && npm pack && npm run test:prepublish

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,6 @@ FodyWeavers.xsd
420420
*.msm
421421
*.msp
422422

423-
.DS_Store
423+
.DS_Store
424+
*.tgz
425+
temp-lib/

nodejs/tests/PrePublishTests/PrePublish.test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ const https = require("https");
1111
describe("Tests for most recent .tgz package", function () {
1212
const baseDir = path.join(__dirname, "../..");
1313
const extractPath = path.join(baseDir, "temp-lib");
14-
let URIValidate;
14+
let URIValidator;
1515
let AntiSSRFPolicy;
16+
let PolicyConfigOptions;
1617

1718
before(async function () {
1819
// Find the .tgz file dynamically
@@ -37,13 +38,14 @@ describe("Tests for most recent .tgz package", function () {
3738
}); // Dynamically require the AddOne function
3839

3940
const lib = require(path.join(extractPath, "out/src/index.js")); // Adjust if needed
40-
URIValidate = lib.URIValidate;
41+
URIValidator = lib.URIValidator;
4142
AntiSSRFPolicy = lib.AntiSSRFPolicy;
43+
PolicyConfigOptions = lib.PolicyConfigOptions;
4244
});
4345

44-
it("URIValidate.inDomain test", () => {
45-
assert.equal(URIValidate.inDomain("https://example.com", ".example.com"), true);
46-
assert.equal(URIValidate.inDomain("https://example.com.evil.com", "example.com"), false);
46+
it("URIValidator.inDomain test", () => {
47+
assert.equal(URIValidator.inDomain("https://example.com", ".example.com"), true);
48+
assert.equal(URIValidator.inDomain("https://example.com.evil.com", "example.com"), false);
4749
});
4850

4951
describe("AntiSSRFPolicy tests", () => {
@@ -54,11 +56,11 @@ describe("Tests for most recent .tgz package", function () {
5456
policy.addRequiredHeaders(["test-required-header"]);
5557
policy.addDeniedHeaders(["test-denied-header"]);
5658

57-
googleIPs = await dns.promises.lookup("www.google.com", {
59+
const googleIPs = await dns.promises.lookup("www.google.com", {
5860
family: 0,
5961
all: true
6062
});
61-
appleIPs = await dns.promises.lookup("apple.com", { family: 0, all: true });
63+
const appleIPs = await dns.promises.lookup("apple.com", { family: 0, all: true });
6264
policy.addDeniedAddresses([...googleIPs, ...appleIPs].map((address) => address.address));
6365

6466
antiSSRFHttpsAgent = policy.getHttpsAgent();

0 commit comments

Comments
 (0)