From 787e3792ddcc1f3810f784bb0e69ed8a7c528a44 Mon Sep 17 00:00:00 2001 From: DevSide Date: Wed, 30 Oct 2024 14:17:17 +0100 Subject: [PATCH] chore: more yml tests --- packages/dynamock/test/bin.spec.ts | 14 +- packages/dynamock/test/config/utils.ts | 14 +- packages/dynamock/test/integrations.spec.ts | 187 ------------------ packages/puppeteer/src/index.ts | 15 +- packages/puppeteer/test/config/setupTests.ts | 1 + packages/puppeteer/test/puppeteer.spec.ts | 9 +- packages/test-cases/index.ts | 9 +- .../matching-cookies-exact-multiple.yml | 81 ++++++++ .../cookies/matching-cookies-exact.yml | 50 +++++ .../cookies/matching-cookies-partial.yml | 52 +++++ .../matching-cookies-regex-and-simple.yml | 90 +++++++++ .../cookies/matching-cookies-regex.yml | 56 ++++++ .../matching-cookies-strict-multiple.yml | 90 +++++++++ .../cookies/matching-cookies-type.yml | 85 ++++++++ .../no-matching-cookies-exact-mutiple.yml | 52 +++++ .../cookies/no-matching-cookies-exact.yml | 50 +++++ .../no-matching-cookies-regex-and-simple.yml | 60 ++++++ .../cookies/no-matching-cookies-regex.yml | 56 ++++++ .../no-matching-cookies-strict-multiple.yml | 93 +++++++++ .../matching-headers-exact-multiple.yml | 81 ++++++++ .../headers/matching-headers-exact.yml | 50 +++++ ...tching-headers-insensitive-key-reverse.yml | 50 +++++ .../matching-headers-insensitive-key.yml | 50 +++++ .../headers/matching-headers-partial.yml | 52 +++++ .../matching-headers-regex-and-simple.yml | 90 +++++++++ .../headers/matching-headers-regex.yml | 56 ++++++ .../headers/matching-headers-type.yml | 85 ++++++++ .../no-matching-headers-exact-mutiple.yml | 52 +++++ .../headers/no-matching-headers-exact.yml | 50 +++++ .../no-matching-headers-regex-and-simple.yml | 60 ++++++ .../headers/no-matching-headers-regex.yml | 56 ++++++ .../matching/method/matching-method-case.yml | 34 ++++ .../matching/method/matching-method-regex.yml | 75 +++++++ .../matching/method/matching-method-star.yml | 47 +++++ .../{ => path}/matching-path-multiple.yml | 0 .../{ => path}/matching-path-regexp.yml | 0 .../{ => path}/matching-path-simple.yml | 0 .../{ => path}/matching-path-star.yml | 0 .../{ => path}/no-matching-path-subpath.yml | 0 .../no-matching-path-trailing-reverse.yml | 0 .../{ => path}/no-matching-path-trailing.yml | 0 41 files changed, 1746 insertions(+), 206 deletions(-) create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact-multiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-partial.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex-and-simple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-strict-multiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-type.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact-mutiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex-and-simple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-strict-multiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact-multiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key-reverse.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-partial.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex-and-simple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/matching-headers-type.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact-mutiple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex-and-simple.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/method/matching-method-case.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/method/matching-method-regex.yml create mode 100644 packages/test-cases/test-files/fixtures/matching/method/matching-method-star.yml rename packages/test-cases/test-files/fixtures/matching/{ => path}/matching-path-multiple.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/matching-path-regexp.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/matching-path-simple.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/matching-path-star.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/no-matching-path-subpath.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/no-matching-path-trailing-reverse.yml (100%) rename packages/test-cases/test-files/fixtures/matching/{ => path}/no-matching-path-trailing.yml (100%) diff --git a/packages/dynamock/test/bin.spec.ts b/packages/dynamock/test/bin.spec.ts index 0a96827..edd1872 100644 --- a/packages/dynamock/test/bin.spec.ts +++ b/packages/dynamock/test/bin.spec.ts @@ -26,7 +26,7 @@ describe('bin integration tests', () => { for (let i = 0; i < testData.length; i++) { const { action, expectation } = testData[i] - const { path, method, headers, body, bodyJSON, query } = action + const { path, method, headers, cookies, body, bodyJSON, query } = action const fetchOptions: { method: string headers: { [key: string]: string } @@ -53,6 +53,18 @@ describe('bin integration tests', () => { url.searchParams.set(queryKey, query[queryKey]) } + // nodejs fetch method "patch" is working only in upper case + // CF: https://github.com/nodejs/node/issues/51336 + if (fetchOptions.method === 'patch') { + fetchOptions.method = 'PATCH' + } + + if (cookies) { + fetchOptions.headers.cookie = Object.entries(cookies) + .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) + .join('; ') + } + const result = await fetch(url.toString(), fetchOptions) if (expectation) { diff --git a/packages/dynamock/test/config/utils.ts b/packages/dynamock/test/config/utils.ts index 19611ab..24ceb33 100644 --- a/packages/dynamock/test/config/utils.ts +++ b/packages/dynamock/test/config/utils.ts @@ -4,18 +4,20 @@ const isPortUsed = async (port: number): Promise => { return new Promise((resolve) => { const server = createServer() server.once('error', (err: Error) => { - server.close() - resolve('code' in err && err.code === 'EADDRINUSE') + server.close(() => { + resolve('code' in err && err.code === 'EADDRINUSE') + }) }) server.once('listening', () => { - server.close() - resolve(false) + server.close(() => { + resolve(false) + }) }) server.listen(port) }) } -export function waitPortUsed(port: number, reverse = false, retry = 50) { +export function waitPortUsed(port: number, retry = 50, reverse = false) { return new Promise((resolve) => { const loop = async () => { const isUsed = await isPortUsed(port) @@ -35,5 +37,5 @@ export function waitPortUsed(port: number, reverse = false, retry = 50) { } export function waitPortFree(port: number, retry?: number) { - return waitPortUsed(port, true, retry) + return waitPortUsed(port, retry, true) } diff --git a/packages/dynamock/test/integrations.spec.ts b/packages/dynamock/test/integrations.spec.ts index fb48871..615132f 100644 --- a/packages/dynamock/test/integrations.spec.ts +++ b/packages/dynamock/test/integrations.spec.ts @@ -167,193 +167,6 @@ describe('integrations.js', () => { }) }) - describe('matching method', () => { - test.each([ - ['get', null, 'get', true], - ['post', null, 'post', true], - ['*', null, 'get', true], - ['*', null, 'post', true], - ['/(get|post)/', { allowRegex: true }, 'get', true], - ['/(get|post)/', { allowRegex: true }, 'post', true], - ])( - 'matching method match="%s" options="%o" test="%s" result=%s', - async (matchMethod, options, method, shouldMatch) => { - const path = '/test' - - await request - .post('/___fixtures') - .send({ - request: { - path, - method: matchMethod, - ...(options - ? { - options: { - method: options, - }, - } - : {}), - }, - response: { - body: '', - }, - }) - .expect(201) - - await request[method as Method](path).expect(shouldMatch ? 200 : 404) - }, - ) - }) - - describe('matching headers', () => { - test.each([ - [null, { a: 'a' }, null, { a: 'a' }, true], - [null, { a: 'a' }, null, { A: 'a' }, true], - [null, { A: 'a' }, null, { a: 'a' }, true], - [null, { a: 1 }, null, { a: '1' }, true], - [null, { a: [] }, null, { a: '[]' }, true], - [null, { a: { b: 'b' } }, null, { a: '{"b":"b"}' }, true], - [null, { a: null }, null, { a: 'null' }, true], - [null, { a: 'a' }, { allowRegex: true }, { a: 'a' }, true], - [null, { a: '/a/' }, { allowRegex: true }, { a: 'a' }, true], - [null, { a: '/A/' }, { allowRegex: true }, { a: 'a' }, false], - [null, { a: '/A/ig' }, { allowRegex: true }, { a: 'a' }, true], - [null, { a: 'a' }, null, { a: 'a', b: 'b' }, true], - [null, { a: '/a/' }, { allowRegex: true }, { a: 'a', b: 'b' }, true], - [null, { a: 'a', b: 'b' }, null, { a: 'a' }, false], - [null, { a: '/a/', b: 'b' }, { allowRegex: true }, { a: 'a' }, false], - [{ custom: { a: 'a' } }, ['custom'], null, {}, false], - [{ custom: { a: '/a/' } }, ['custom'], { allowRegex: true }, {}, false], - [{ custom: { a: 'a' } }, ['custom'], null, { a: 'a' }, true], - [{ custom: { a: '/a/' } }, ['custom'], { allowRegex: true }, { a: 'a' }, true], - [{ custom: { a: 'a', b: 'b' } }, ['custom'], null, { a: 'a' }, false], - [{ custom: { a: '/a/', b: '/b/' } }, ['custom'], { allowRegex: true }, { a: 'a' }, false], - [{ custom: { a: 'a', b: 'b' } }, ['custom'], null, { a: 'a', b: 'b' }, true], - [{ a: { a: 'a' }, b: { b: 'b' } }, ['a', 'b'], null, { a: 'a' }, false], - [{ a: { a: 'a' }, b: { b: 'b' } }, ['a', 'b'], null, { a: 'a', b: 'b' }, true], - ])( - 'match headers config="%o" match="%o" options="%o" result=%s', - async (configuration, matchValues, options, values, shouldMatch) => { - const path = '/test' - const method = 'get' - - if (configuration) { - await request - .put('/___config') - .send({ - headers: configuration, - }) - .expect(200) - } - - await request - .post('/___fixtures') - .send({ - request: { - path, - method, - headers: matchValues, - ...(options - ? { - options: { - headers: options, - }, - } - : {}), - }, - response: { - body: '', - }, - }) - .expect(201) - - await request[method](path) - .set(values) - .expect(shouldMatch ? 200 : 404) - }, - ) - }) - - describe('matching cookies', () => { - test.each([ - [null, { x: 'x' }, { x: 'x' }, null, true], - [null, { x: 1 }, { x: '1' }, null, true], - [null, { x: [] }, { x: '[]' }, null, true], - [null, { x: { y: 'y' } }, { x: '{"y":"y"}' }, null, true], - [null, { x: 'x' }, { x: 'x' }, { strict: false }, true], - [null, { x: 'x' }, { x: 'x' }, { allowRegex: true }, true], - [null, { x: '/x/' }, { x: 'x' }, { allowRegex: true }, true], - [null, { x: 'x' }, { x: 'x' }, { strict: true }, true], - [null, { x: 'x' }, { x: 'x', y: 'y' }, { strict: true }, false], - [null, { x: 'x', y: 'y' }, { x: 'x' }, { strict: true }, false], - [null, { x: 'x' }, { x: 'x', other: 'other' }, null, true], - [null, { x: '/x/' }, { x: 'x', other: 'other' }, { allowRegex: true }, true], - [null, { x: 'x' }, { x: 'x', other: 'other' }, { strict: true }, false], - [null, { x: 'x', other: 'other' }, { x: 'x' }, null, false], - [null, { x: '/x/', other: 'other' }, { x: 'x' }, { allowRegex: true }, false], - [{ xOnly: { x: 'x' } }, ['xOnly'], {}, null, false], - [{ xOnly: { x: '/x/' } }, ['xOnly'], {}, { allowRegex: true }, false], - [{ xOnly: { x: 'x' } }, ['xOnly'], { x: 'x' }, null, true], - [{ xOnly: { x: '/X/i' } }, ['xOnly'], { x: 'x' }, { allowRegex: true }, true], - [{ xOnly: { x: 'x' } }, ['xOnly'], { x: 'x' }, { strict: true }, true], - [{ xAndY: { x: 'x', y: 'y' } }, ['xAndY'], { x: 'x' }, null, false], - [{ xAndY: { x: 'x', y: 'y' } }, ['xAndY'], { x: 'x', y: 'y' }, null, true], - [{ xAndY: { x: '/X/ig', y: '/Y/ig' } }, ['xAndY'], { x: 'x', y: 'y' }, { allowRegex: true }, true], - [{ xAndY: { x: 'x', y: 'y' } }, ['xAndY'], { x: 'x', y: 'y' }, { strict: true }, true], - [{ xOnly: { x: 'x' }, yOnly: { y: 'y' } }, ['xOnly', 'yOnly'], { x: 'x' }, null, false], - [{ xOnly: { x: 'x' }, yOnly: { y: 'y' } }, ['xOnly', 'yOnly'], { x: 'x', y: 'y' }, null, true], - [{ xOnly: { x: 'x' } }, ['xOnly', { y: 'y' }], { x: 'x', y: 'y' }, null, true], - ])( - 'match cookies config=%o match=%o request=%o result=%s', - async (configuration, matchValues, values, options, shouldMatch) => { - const path = '/test' - const method = 'get' - - if (configuration) { - await request - .put('/___config') - .send({ - cookies: configuration, - }) - .expect(200) - } - - await request - .post('/___fixtures') - .send({ - request: { - path, - method, - cookies: matchValues, - ...(options - ? { - options: { - cookies: options, - }, - } - : {}), - }, - response: { - body: '', - }, - }) - .expect(201) - - const cookies = Object.entries(values) - .reduce((acc, [key, value]) => { - // @ts-ignore - acc.push(`${key}=${value}`) - return acc - }, []) - .join(';') - - await request[method](path) - .set('Cookie', cookies) - .expect(shouldMatch ? 200 : 404) - }, - ) - }) - describe('matching query', () => { test.each([ [null, '/test', { x: '1' }, '/test', null, false], diff --git a/packages/puppeteer/src/index.ts b/packages/puppeteer/src/index.ts index 37eb06d..a3f8318 100644 --- a/packages/puppeteer/src/index.ts +++ b/packages/puppeteer/src/index.ts @@ -41,13 +41,24 @@ function mapToCoreRequest(request: HTTPRequest): CoreRequest { const parsedUrl = new URL(request.url()) + const { cookie: cookieHeader, ...headersWithoutCookie } = headers + + const cookies = cookieHeader + ? Object.fromEntries( + cookieHeader.split('; ').map((cookie) => { + const [key, value] = cookie.split('=') + return [decodeURIComponent(key), decodeURIComponent(value)] + }), + ) + : {} + return { origin: parsedUrl.origin, path: parsedUrl.pathname, method: request.method(), body, - headers: request.headers(), - cookies: {}, + headers: headersWithoutCookie, + cookies, query: Object.entries(parsedUrl.searchParams).reduce<{ [key in string]: string }>((acc, [key, value]) => { if (value) { if (typeof value === 'string') { diff --git a/packages/puppeteer/test/config/setupTests.ts b/packages/puppeteer/test/config/setupTests.ts index 3e8bc41..37b0e90 100644 --- a/packages/puppeteer/test/config/setupTests.ts +++ b/packages/puppeteer/test/config/setupTests.ts @@ -33,6 +33,7 @@ beforeEach(async () => { }) afterEach(async () => { + await page.deleteCookie(...(await page.cookies())) await page.close() }) diff --git a/packages/puppeteer/test/puppeteer.spec.ts b/packages/puppeteer/test/puppeteer.spec.ts index b29a481..fa2e5d2 100644 --- a/packages/puppeteer/test/puppeteer.spec.ts +++ b/packages/puppeteer/test/puppeteer.spec.ts @@ -4,7 +4,7 @@ import { ActionEnum, getTestFiles, wrapError } from '@dynamock/test-cases' import { getPuppeteerTestCases } from './config/getTestCases.js' describe('puppeteer integration tests', () => { - const allTests = getTestFiles().filter(([filePath]) => filePath.endsWith('.yml')) + const allTests = getTestFiles() //.filter(([filePath]) => filePath.endsWith('create-and-delete-bulk.yml')) beforeEach(() => page.goto('http://127.0.0.1:3000/index.html')) @@ -43,10 +43,14 @@ describe('puppeteer integration tests', () => { break } case ActionEnum.test_fixture: { - const { path, method, body, bodyJSON, headers, query } = action.data + const { path, method, body, bodyJSON, headers, cookies, query } = action.data const safeHeaders = headers ?? {} const safeQuery = query ?? {} + if (cookies) { + await page.setCookie(...Object.entries(cookies ?? {}).map(([name, value]) => ({ name, value }))) + } + const result = await page.evaluate( async (_path, _method, _body, _bodyJSON, _headers, _query) => { const fetchOptions: { @@ -75,6 +79,7 @@ describe('puppeteer integration tests', () => { url.searchParams.set(queryKey, _query[queryKey]) } + console.log('pup test fetch', url.toString(), fetchOptions) const result = await fetch(url.toString(), fetchOptions) const bodyText = await result.text() diff --git a/packages/test-cases/index.ts b/packages/test-cases/index.ts index 2fa63fb..b0db099 100644 --- a/packages/test-cases/index.ts +++ b/packages/test-cases/index.ts @@ -48,6 +48,7 @@ export type ApiTest = { path: string method: string headers?: { [key: string]: string } + cookies?: { [key: string]: string } query?: { [key: string]: string } body?: null | string bodyJSON?: unknown @@ -121,11 +122,3 @@ export async function wrapError(testIndex: number, task: () => unknown) { throw error } } - -export function fetchHeadersToObject(headers: HeadersInit) { - return Object.entries(headers).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = value - - return acc - }, {}) -} diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact-multiple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact-multiple.yml new file mode 100644 index 0000000..6eeeb86 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact-multiple.yml @@ -0,0 +1,81 @@ +- action: + name: post_fixture + data: + request: + path: /exact-multiple + method: GET + cookies: + a: a + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple + method: GET + cookies: + a: a + b: b + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: a + b: b + customA: + a: a + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration + method: GET + cookies: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration + method: GET + cookies: + a: a + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration-2 + method: GET + cookies: + - customA + - customB + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration-2 + method: GET + cookies: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact.yml new file mode 100644 index 0000000..db01c0d --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-exact.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /exact + method: GET + cookies: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact + method: GET + cookies: + a: a + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-configuration + method: GET + cookies: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-configuration + method: GET + cookies: + a: a + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-partial.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-partial.yml new file mode 100644 index 0000000..dd5946b --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-partial.yml @@ -0,0 +1,52 @@ +- action: + name: post_fixture + data: + request: + path: /partial + method: GET + cookies: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /partial + method: GET + cookies: + a: a + b: b + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /partial-configuration + method: GET + cookies: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /partial-configuration + method: GET + cookies: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex-and-simple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex-and-simple.yml new file mode 100644 index 0000000..d20f968 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex-and-simple.yml @@ -0,0 +1,90 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + cookies: + a: '/A+/ig' + b: b + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + cookies: + a: aAaA + b: b + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: '/A+/ig' + b: b + customA: + a: '/A+/ig' + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + cookies: + - custom + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + cookies: + a: aAaA + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration-2 + method: GET + cookies: + - customA + - customB + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration-2 + method: GET + cookies: + a: aAaA + b: b + expectation: + status: 200 diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex.yml new file mode 100644 index 0000000..ecd27b5 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-regex.yml @@ -0,0 +1,56 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + cookies: + a: '/A+/ig' + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + cookies: + a: aAaA + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: '/A+/ig' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + cookies: + - custom + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + cookies: + a: aAaA + expectation: + status: 200 diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-strict-multiple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-strict-multiple.yml new file mode 100644 index 0000000..9c4c60a --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-strict-multiple.yml @@ -0,0 +1,90 @@ +- action: + name: post_fixture + data: + request: + path: /strict-multiple + method: GET + cookies: + a: a + b: b + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple + method: GET + cookies: + a: a + b: b + expectation: + status: 200 +- action: + name: put_config + data: + cookies: + custom: + a: a + b: b + customA: + a: a + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /strict-multiple-configuration + method: GET + cookies: + - custom + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple-configuration + method: GET + cookies: + a: a + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /strict-multiple-configuration-2 + method: GET + cookies: + - customA + - customB + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple-configuration-2 + method: GET + cookies: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-type.yml b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-type.yml new file mode 100644 index 0000000..acf422e --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/matching-cookies-type.yml @@ -0,0 +1,85 @@ +- action: + name: post_fixture + data: + request: + path: / + method: GET + cookies: + a: 1 + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + cookies: + a: "1" + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + cookies: + a: [] + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + cookies: + a: "[]" + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + cookies: + a: + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + cookies: + a: '{"b":"b"}' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + cookies: + a: null + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + cookies: + a: 'null' + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact-mutiple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact-mutiple.yml new file mode 100644 index 0000000..b40cd70 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact-mutiple.yml @@ -0,0 +1,52 @@ +- action: + name: post_fixture + data: + request: + path: /exact-multiple + method: GET + cookies: + a: a + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple + method: GET + cookies: + a: a + expectation: + status: 404 +- action: + name: put_config + data: + cookies: + custom: + a: a + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration + method: GET + cookies: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration + method: GET + cookies: + a: a + expectation: + status: 404 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact.yml b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact.yml new file mode 100644 index 0000000..f94318e --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-exact.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /exact + method: GET + cookies: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact + method: GET + cookies: + b: b + expectation: + status: 404 +- action: + name: put_config + data: + cookies: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-configuration + method: GET + cookies: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-configuration + method: GET + cookies: + b: b + expectation: + status: 404 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex-and-simple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex-and-simple.yml new file mode 100644 index 0000000..2ebb1cc --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex-and-simple.yml @@ -0,0 +1,60 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + cookies: + a: '/A+/ig' + b: b + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + cookies: + a: aAaA + b: c + expectation: + status: 404 +- action: + name: put_config + data: + cookies: + custom: + a: '/A+/ig' + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + cookies: + - custom + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + cookies: + a: aAaA + b: c + expectation: + status: 404 diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex.yml b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex.yml new file mode 100644 index 0000000..e1580dd --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-regex.yml @@ -0,0 +1,56 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + cookies: + a: '/A+/ig' + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + cookies: + a: b + expectation: + status: 404 +- action: + name: put_config + data: + cookies: + custom: + a: '/A+/ig' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + cookies: + - custom + options: + cookies: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + cookies: + a: b + expectation: + status: 404 diff --git a/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-strict-multiple.yml b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-strict-multiple.yml new file mode 100644 index 0000000..f3bb09a --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/cookies/no-matching-cookies-strict-multiple.yml @@ -0,0 +1,93 @@ +- action: + name: post_fixture + data: + request: + path: /strict-multiple + method: GET + cookies: + a: a + b: b + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple + method: GET + cookies: + a: a + b: b + c: c + expectation: + status: 404 +- action: + name: put_config + data: + cookies: + custom: + a: a + b: b + customA: + a: a + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /strict-multiple-configuration + method: GET + cookies: + - custom + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple-configuration + method: GET + cookies: + a: a + b: b + c: c + expectation: + status: 404 +- action: + name: post_fixture + data: + request: + path: /strict-multiple-configuration-2 + method: GET + cookies: + - customA + - customB + options: + cookies: + strict: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /strict-multiple-configuration-2 + method: GET + cookies: + a: a + b: b + c: c + expectation: + status: 404 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact-multiple.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact-multiple.yml new file mode 100644 index 0000000..b4a4705 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact-multiple.yml @@ -0,0 +1,81 @@ +- action: + name: post_fixture + data: + request: + path: /exact-multiple + method: GET + headers: + a: a + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple + method: GET + headers: + a: a + b: b + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: a + b: b + customA: + a: a + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration + method: GET + headers: + a: a + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration-2 + method: GET + headers: + - customA + - customB + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration-2 + method: GET + headers: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact.yml new file mode 100644 index 0000000..e1e858a --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-exact.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /exact + method: GET + headers: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact + method: GET + headers: + a: a + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-configuration + method: GET + headers: + a: a + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key-reverse.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key-reverse.yml new file mode 100644 index 0000000..8acd25d --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key-reverse.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /insensitive + method: GET + headers: + A: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /insensitive + method: GET + headers: + a: a + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + A: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /insensitive-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /insensitive-configuration + method: GET + headers: + a: a + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key.yml new file mode 100644 index 0000000..7be108b --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-insensitive-key.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /insensitive + method: GET + headers: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /insensitive + method: GET + headers: + A: a + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /insensitive-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /insensitive-configuration + method: GET + headers: + A: a + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-partial.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-partial.yml new file mode 100644 index 0000000..e9c94fc --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-partial.yml @@ -0,0 +1,52 @@ +- action: + name: post_fixture + data: + request: + path: /partial + method: GET + headers: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /partial + method: GET + headers: + a: a + b: b + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /partial-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /partial-configuration + method: GET + headers: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex-and-simple.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex-and-simple.yml new file mode 100644 index 0000000..ac0ddd6 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex-and-simple.yml @@ -0,0 +1,90 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + headers: + a: '/A+/ig' + b: b + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + headers: + a: aAaA + b: b + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: '/A+/ig' + b: b + customA: + a: '/A+/ig' + customB: + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + headers: + - custom + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + headers: + a: aAaA + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration-2 + method: GET + headers: + - customA + - customB + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration-2 + method: GET + headers: + a: aAaA + b: b + expectation: + status: 200 diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex.yml new file mode 100644 index 0000000..0c88343 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-regex.yml @@ -0,0 +1,56 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + headers: + a: '/A+/ig' + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + headers: + a: aAaA + expectation: + status: 200 +- action: + name: put_config + data: + headers: + custom: + a: '/A+/ig' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + headers: + - custom + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + headers: + a: aAaA + expectation: + status: 200 diff --git a/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-type.yml b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-type.yml new file mode 100644 index 0000000..59125e3 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/matching-headers-type.yml @@ -0,0 +1,85 @@ +- action: + name: post_fixture + data: + request: + path: / + method: GET + headers: + a: 1 + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + headers: + a: "1" + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + headers: + a: [] + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + headers: + a: "[]" + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + headers: + a: + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + headers: + a: '{"b":"b"}' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: / + method: GET + headers: + a: null + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + headers: + a: 'null' + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact-mutiple.yml b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact-mutiple.yml new file mode 100644 index 0000000..769fcc4 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact-mutiple.yml @@ -0,0 +1,52 @@ +- action: + name: post_fixture + data: + request: + path: /exact-multiple + method: GET + headers: + a: a + b: b + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple + method: GET + headers: + a: a + expectation: + status: 404 +- action: + name: put_config + data: + headers: + custom: + a: a + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-multiple-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-multiple-configuration + method: GET + headers: + a: a + expectation: + status: 404 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact.yml b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact.yml new file mode 100644 index 0000000..f05fa72 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-exact.yml @@ -0,0 +1,50 @@ +- action: + name: post_fixture + data: + request: + path: /exact + method: GET + headers: + a: a + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact + method: GET + headers: + b: b + expectation: + status: 404 +- action: + name: put_config + data: + headers: + custom: + a: a + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /exact-configuration + method: GET + headers: + - custom + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /exact-configuration + method: GET + headers: + b: b + expectation: + status: 404 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex-and-simple.yml b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex-and-simple.yml new file mode 100644 index 0000000..4d37058 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex-and-simple.yml @@ -0,0 +1,60 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + headers: + a: '/A+/ig' + b: b + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + headers: + a: aAaA + b: c + expectation: + status: 404 +- action: + name: put_config + data: + headers: + custom: + a: '/A+/ig' + b: b + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + headers: + - custom + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + headers: + a: aAaA + b: c + expectation: + status: 404 diff --git a/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex.yml b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex.yml new file mode 100644 index 0000000..21fb784 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/headers/no-matching-headers-regex.yml @@ -0,0 +1,56 @@ +- action: + name: post_fixture + data: + request: + path: /regex + method: GET + headers: + a: '/A+/ig' + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex + method: GET + headers: + a: b + expectation: + status: 404 +- action: + name: put_config + data: + headers: + custom: + a: '/A+/ig' + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /regex-configuration + method: GET + headers: + - custom + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /regex-configuration + method: GET + headers: + a: b + expectation: + status: 404 diff --git a/packages/test-cases/test-files/fixtures/matching/method/matching-method-case.yml b/packages/test-cases/test-files/fixtures/matching/method/matching-method-case.yml new file mode 100644 index 0000000..5ac2f5b --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/method/matching-method-case.yml @@ -0,0 +1,34 @@ +- action: + name: post_fixture + data: + request: + path: /a + method: get + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /a + method: GET + expectation: + status: 200 +- action: + name: post_fixture + data: + request: + path: /a + method: GET + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /a + method: get + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/method/matching-method-regex.yml b/packages/test-cases/test-files/fixtures/matching/method/matching-method-regex.yml new file mode 100644 index 0000000..0075db3 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/method/matching-method-regex.yml @@ -0,0 +1,75 @@ +- action: + name: post_fixture + data: + request: + path: /a + method: /(get|post)/ + options: + method: + allowRegex: true + response: + status: 200 + options: + lifetime: 0 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /a + method: get + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: GET + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: post + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: POST + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: options + expectation: + status: 404 +- action: + name: post_fixture + data: + request: + path: / + method: GET + headers: + a: '/a/' + options: + headers: + allowRegex: true + response: + status: 200 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: / + method: GET + headers: + a: a + b: b + expectation: + status: 200 \ No newline at end of file diff --git a/packages/test-cases/test-files/fixtures/matching/method/matching-method-star.yml b/packages/test-cases/test-files/fixtures/matching/method/matching-method-star.yml new file mode 100644 index 0000000..5fec860 --- /dev/null +++ b/packages/test-cases/test-files/fixtures/matching/method/matching-method-star.yml @@ -0,0 +1,47 @@ +- action: + name: post_fixture + data: + request: + path: /a + method: "*" + response: + status: 200 + options: + lifetime: 0 + expectation: + status: 201 +- action: + name: test_fixture + data: + path: /a + method: get + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: GET + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: post + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: put + expectation: + status: 200 +- action: + name: test_fixture + data: + path: /a + method: PATCH + expectation: + status: 200 diff --git a/packages/test-cases/test-files/fixtures/matching/matching-path-multiple.yml b/packages/test-cases/test-files/fixtures/matching/path/matching-path-multiple.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/matching-path-multiple.yml rename to packages/test-cases/test-files/fixtures/matching/path/matching-path-multiple.yml diff --git a/packages/test-cases/test-files/fixtures/matching/matching-path-regexp.yml b/packages/test-cases/test-files/fixtures/matching/path/matching-path-regexp.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/matching-path-regexp.yml rename to packages/test-cases/test-files/fixtures/matching/path/matching-path-regexp.yml diff --git a/packages/test-cases/test-files/fixtures/matching/matching-path-simple.yml b/packages/test-cases/test-files/fixtures/matching/path/matching-path-simple.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/matching-path-simple.yml rename to packages/test-cases/test-files/fixtures/matching/path/matching-path-simple.yml diff --git a/packages/test-cases/test-files/fixtures/matching/matching-path-star.yml b/packages/test-cases/test-files/fixtures/matching/path/matching-path-star.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/matching-path-star.yml rename to packages/test-cases/test-files/fixtures/matching/path/matching-path-star.yml diff --git a/packages/test-cases/test-files/fixtures/matching/no-matching-path-subpath.yml b/packages/test-cases/test-files/fixtures/matching/path/no-matching-path-subpath.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/no-matching-path-subpath.yml rename to packages/test-cases/test-files/fixtures/matching/path/no-matching-path-subpath.yml diff --git a/packages/test-cases/test-files/fixtures/matching/no-matching-path-trailing-reverse.yml b/packages/test-cases/test-files/fixtures/matching/path/no-matching-path-trailing-reverse.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/no-matching-path-trailing-reverse.yml rename to packages/test-cases/test-files/fixtures/matching/path/no-matching-path-trailing-reverse.yml diff --git a/packages/test-cases/test-files/fixtures/matching/no-matching-path-trailing.yml b/packages/test-cases/test-files/fixtures/matching/path/no-matching-path-trailing.yml similarity index 100% rename from packages/test-cases/test-files/fixtures/matching/no-matching-path-trailing.yml rename to packages/test-cases/test-files/fixtures/matching/path/no-matching-path-trailing.yml