From 4f4817fb08659ee0c111d378d917d87833ea7960 Mon Sep 17 00:00:00 2001 From: nimat1 Date: Mon, 25 Nov 2024 08:20:54 +0000 Subject: [PATCH 1/2] code-of-conduct --- .../tests/cms/codeofconduct.test.ts | 17 +++++++++ .../utils/datafactory/codeofconduct.data.ts | 38 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 integration-test/tests/cms/codeofconduct.test.ts create mode 100644 integration-test/utils/datafactory/codeofconduct.data.ts diff --git a/integration-test/tests/cms/codeofconduct.test.ts b/integration-test/tests/cms/codeofconduct.test.ts new file mode 100644 index 0000000..39b426c --- /dev/null +++ b/integration-test/tests/cms/codeofconduct.test.ts @@ -0,0 +1,17 @@ +import {expect, test} from '@playwright/test'; +import { codeofconductExepctedInformation } from '../../utils/datafactory/codeofconduct.data'; +test('GET /api/cms/v1/code-of-conduct returns correct team data', async ({request}) => { + const response = await request.get(`https://wcc-backend.fly.dev/api/cms/v1/code-of-conduct`); + + if (response.status() === 200) { + console.log('API Test Passed: Status 200'); + } else { + console.error('API Test Failed'); + } + + const body = await response.json(); + + const expectedResponse = codeofconductExepctedInformation; + + expect(body).toEqual(expectedResponse); + }); diff --git a/integration-test/utils/datafactory/codeofconduct.data.ts b/integration-test/utils/datafactory/codeofconduct.data.ts new file mode 100644 index 0000000..f1f6f91 --- /dev/null +++ b/integration-test/utils/datafactory/codeofconduct.data.ts @@ -0,0 +1,38 @@ +export const codeofconductExepctedInformation = { + "page": { + "title": "Code of Conduct", + "description": "At Women Coding Community we are committed to a vibrant, supportive community where women can network, share experiences, and foster professional relationships, regardless of age, gender, visible or invisible disability, ethnicity, gender expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual orientation or preferred programming language(s)." + }, + "items": [ + { + "title": "Our Standards", + "description": "To ensure a positive experience for all members, we expect participants to exhibit the following behaviors:", + "items": [ + "Respect: Treat everyone with respect, dignity, and empathy. Listen and communicate thoughtfully.", + "Inclusivity: Actively seek to acknowledge and respect the diversity of our community.", + "Collaboration: Share knowledge generously and assist others when possible, fostering a collaborative atmosphere.", + "Constructive Communication: Engage in constructive, positive communication. Provide and gracefully accept constructive criticism.", + "Professionalism: Be professional in all interactions within the community. Avoid behavior or language that may be considered inappropriate or offensive." + ] + }, + { + "title": "Unacceptable Behavior", + "description": "The following behaviors are considered harassment and are unacceptable within our community:", + "items": [ + "Violence, threats of violence, or violent language directed against another member or group.", + "Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.", + "Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.", + "Inappropriate photography or recording.", + "Advocating for, or encouraging, any of the above behavior." + ] + }, + { + "title": "Enforcement", + "description": "Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Instances of abusive, harassing, or otherwise unacceptable behavior can be reported by email. All complaints will be reviewed and investigated promptly and fairly." + }, + { + "title": "Consequences", + "description": "Actions determined to be contrary to these guidelines may result in consequences ranging from a warning to expulsion from the community, future events depending on the severity of the behavior." + } + ] + } From 3e5b780571f103c3d21f776272032fa1b8c9a550 Mon Sep 17 00:00:00 2001 From: nimat1 Date: Thu, 28 Nov 2024 17:44:14 +0000 Subject: [PATCH 2/2] fixed url issue --- integration-test/tests/cms/codeofconduct.test.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/integration-test/tests/cms/codeofconduct.test.ts b/integration-test/tests/cms/codeofconduct.test.ts index 39b426c..8162669 100644 --- a/integration-test/tests/cms/codeofconduct.test.ts +++ b/integration-test/tests/cms/codeofconduct.test.ts @@ -1,14 +1,9 @@ import {expect, test} from '@playwright/test'; import { codeofconductExepctedInformation } from '../../utils/datafactory/codeofconduct.data'; -test('GET /api/cms/v1/code-of-conduct returns correct team data', async ({request}) => { - const response = await request.get(`https://wcc-backend.fly.dev/api/cms/v1/code-of-conduct`); +test('GET /api/cms/v1/code-of-conduct returns correct data', async ({request}) => { + const response = await request.get(`/api/cms/v1/code-of-conduct`); - if (response.status() === 200) { - console.log('API Test Passed: Status 200'); - } else { - console.error('API Test Failed'); - } - + expect(response.status()).toBe(200); const body = await response.json(); const expectedResponse = codeofconductExepctedInformation;