Skip to content

Commit 8269468

Browse files
committed
Move cert fixtures into tls directory
1 parent 4d440f7 commit 8269468

14 files changed

+7
-7
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/error.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ afterAll(() => {
3636
async function startServer(certName: string): Promise<string> {
3737
const server = https.createServer(
3838
{
39-
key: await fs.readFile(path.join(__dirname, `../fixtures/${certName}.key`)),
40-
cert: await fs.readFile(path.join(__dirname, `../fixtures/${certName}.crt`)),
39+
key: await fs.readFile(path.join(__dirname, `../fixtures/tls/${certName}.key`)),
40+
cert: await fs.readFile(path.join(__dirname, `../fixtures/tls/${certName}.crt`)),
4141
},
4242
(req, res) => {
4343
if (req.url?.endsWith("/error")) {
@@ -71,7 +71,7 @@ it("detects partial chains", async () => {
7171
const address = await startServer("chain-leaf")
7272
const request = axios.get(address, {
7373
httpsAgent: new https.Agent({
74-
ca: await fs.readFile(path.join(__dirname, "../fixtures/chain-leaf.crt")),
74+
ca: await fs.readFile(path.join(__dirname, "../fixtures/tls/chain-leaf.crt")),
7575
}),
7676
})
7777
await expect(request).rejects.toHaveProperty("code", X509_ERR_CODE.UNABLE_TO_VERIFY_LEAF_SIGNATURE)
@@ -101,7 +101,7 @@ it("detects self-signed certificates without signing capability", async () => {
101101
const address = await startServer("no-signing")
102102
const request = axios.get(address, {
103103
httpsAgent: new https.Agent({
104-
ca: await fs.readFile(path.join(__dirname, "../fixtures/no-signing.crt")),
104+
ca: await fs.readFile(path.join(__dirname, "../fixtures/tls/no-signing.crt")),
105105
servername: "localhost",
106106
}),
107107
})
@@ -150,7 +150,7 @@ it("is ok with trusted self-signed certificates", async () => {
150150
const address = await startServer("self-signed")
151151
const request = axios.get(address, {
152152
httpsAgent: new https.Agent({
153-
ca: await fs.readFile(path.join(__dirname, "../fixtures/self-signed.crt")),
153+
ca: await fs.readFile(path.join(__dirname, "../fixtures/tls/self-signed.crt")),
154154
servername: "localhost",
155155
}),
156156
})
@@ -188,7 +188,7 @@ it("is ok with chains with a trusted root", async () => {
188188
const address = await startServer("chain")
189189
const request = axios.get(address, {
190190
httpsAgent: new https.Agent({
191-
ca: await fs.readFile(path.join(__dirname, "../fixtures/chain-root.crt")),
191+
ca: await fs.readFile(path.join(__dirname, "../fixtures/tls/chain-root.crt")),
192192
servername: "localhost",
193193
}),
194194
})
@@ -209,7 +209,7 @@ it("falls back with different error", async () => {
209209
const address = await startServer("chain")
210210
const request = axios.get(address + "/error", {
211211
httpsAgent: new https.Agent({
212-
ca: await fs.readFile(path.join(__dirname, "../fixtures/chain-root.crt")),
212+
ca: await fs.readFile(path.join(__dirname, "../fixtures/tls/chain-root.crt")),
213213
servername: "localhost",
214214
}),
215215
})

0 commit comments

Comments
 (0)