{"size": 1115, "ext": "js", "max_stars_repo_path": "backend/test/scenario/createRoom.test.js", "max_stars_repo_name": "idnzozkan/develotalks", "max_stars_repo_stars_event_min_datetime": "2022-03-03T21:02:05.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-03T21:02:05.000Z", "max_issues_repo_path": "backend/test/scenario/createRoom.test.js", "max_issues_repo_name": "idnzozkan/develotalks", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "backend/test/scenario/createRoom.test.js", "max_forks_repo_name": "idnzozkan/develotalks", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.5897435897, "max_line_length": 96, "alphanum_fraction": 0.665470852}
const app = require("../../")
const request = require("supertest")(app)

test("creates a new room", async () => {
  const userToCreate = {
    name: "Test User",
    username: "testuser",
    profilePhoto: "testuser.jpg",
    userBio: "Lorem ipsum dolor sit amet",
    socialLinks: ["https://www.linkedin.com/in/idnzozkan", "https://www.twitter.com/idnzozkan"],
    interests: ["Web Development", "Frontend"],
    spokenLangs: ["English", "Turkish"],
    createdRoom: null,
    activeRoom: null
  }

  const roomToCreate = {
    title: "Test Room Title",
    description: "Test room description",
    roomLanguage: "English",
    maxParticipants: 3,
    canUseMic: true,
    canUseWebcam: true,
    canShareScreen: true,
    canTypeToChatBox: true,
    isPrivate: true,
    roomTags: ["#javascript", "#frontend", "#backend"]
  }

  const userResponse = await request.post("/u").send(userToCreate).expect(200)

  const createdRoomResponse = await request
    .post(`/u/${userResponse.body._id}/createdRoom`)
    .send(roomToCreate)
    .expect(200)

  expect(createdRoomResponse.body).toMatchObject(roomToCreate)
})
