Skip to content

Commit

Permalink
test: add anti assertion for x-cypress-request and remove setting req…
Browse files Browse the repository at this point in the history
…uest verbage (as it does nothing yet)
  • Loading branch information
AtofStryker committed Sep 15, 2022
1 parent 5a93e0a commit 8429821
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/proxy/test/unit/http/request-middleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('http/request-middleware', () => {
})
})

it('removes x-cypress-request header when it exists, sets in on the req', async () => {
it('removes x-cypress-request header when it exists', async () => {
const ctx = {
req: {
headers: {
Expand All @@ -73,6 +73,19 @@ describe('http/request-middleware', () => {
expect(ctx.req.headers['x-cypress-request']).not.to.exist
})
})

it('removes x-cypress-request header when it does not exist', async () => {
const ctx = {
req: {
headers: {},
} as Partial<CypressIncomingRequest>,
}

await testMiddleware([ExtractCypressMetadataHeaders], ctx)
.then(() => {
expect(ctx.req.headers['x-cypress-request']).not.to.exist
})
})
})

describe('MaybeSimulateSecHeaders', () => {
Expand Down

0 comments on commit 8429821

Please sign in to comment.