Best JavaScript code snippet using fast-check-monorepo
quizData.js
Source:quizData.js
1const quizData = [2 {3 id: "1",4 category: "tvd",5 question: `Over the course of the series, which character was NEVER killed by Damon?`,6 choices: [7 { choice: "Alaric Saltzman", isCorrect: false },8 { choice: "Tyler Lockwood", isCorrect: false },9 { choice: "Jeremy Gilbert", isCorrect: false },10 { choice: "Enzo St. John", isCorrect: true },11 ],12 },13 {14 id: "2",15 category: "tvd",16 question: `In that moment, I loved him. I didn't want to, I mean, it terrified me, but for that moment, I loved him.`,17 choices: [18 { choice: "Damon", isCorrect: false },19 { choice: "Elena", isCorrect: true },20 { choice: "Caroline", isCorrect: false },21 { choice: "Stefan", isCorrect: false },22 ],23 },24 {25 id: "3",26 category: "tvd",27 question: `Elena is warm and kind and caring and selfless and it's real. When I'm around her, I completely forget where I am!`,28 choices: [29 { choice: "Damon", isCorrect: false },30 { choice: "Matt", isCorrect: false },31 { choice: "Caroline", isCorrect: false },32 { choice: "Stefan", isCorrect: true },33 ],34 },35 {36 id: "4",37 category: "tvd",38 question: `Which Song Was Reused In Season 5 When Elena Was Trying To Get Stefan To Remember Who He Was?`,39 choices: [40 { choice: "Longest Night", isCorrect: true },41 { choice: "Losing Your Memory", isCorrect: false },42 { choice: "Give Me Love", isCorrect: false },43 { choice: "A Drop In The Ocean", isCorrect: false },44 ],45 },46 {47 id: "5",48 category: "tvd",49 question: ` Where did Caroline and Stefan get married?`,50 choices: [51 { choice: "The Mystic Grill", isCorrect: false },52 { choice: "The Salvatore Boarding House", isCorrect: false },53 { choice: "The Town Square", isCorrect: false },54 { choice: "The Lockwood Mansion", isCorrect: true },55 ],56 },57 {58 id: "6",59 category: "tvd",60 question: `In season 2, how did Bonnie incapacitate Mason?`,61 choices: [62 { choice: "She stabbed him with a silver knife.", isCorrect: false },63 { choice: "She shot him with a silver bullet.", isCorrect: false },64 { choice: "By giving him an aneurysm", isCorrect: true },65 { choice: "She stole the moonstone from Mason", isCorrect: false },66 ],67 },68 {69 id: "7",70 category: "tvd",71 question: `And something tells me that my witch is better than your witch.`,72 choices: [73 { choice: "Katherine", isCorrect: true },74 { choice: "Damon", isCorrect: false },75 { choice: "Elijah", isCorrect: false },76 { choice: "Klaus", isCorrect: false },77 ],78 },79 {80 id: "8",81 category: "tvd",82 question: `Who says this quote; "I have been in love. It's painful, pointless and overrated"?`,83 choices: [84 { choice: "Katherine", isCorrect: false },85 { choice: "Damon", isCorrect: true },86 { choice: "Stefan", isCorrect: false },87 { choice: "Klaus", isCorrect: false },88 ],89 },90 {91 id: "9",92 category: "tvd",93 question: `When Damon and Bonnie are trapped in the prison world with Kai Parker, the same day keeps repeating over and over. What is the date?`,94 choices: [95 { choice: "April 10,1984", isCorrect: false },96 { choice: "April 10,1994", isCorrect: false },97 { choice: "May 10,1994", isCorrect: true },98 { choice: "May 10,1984", isCorrect: false },99 ],100 },101 {102 id: "10",103 category: "tvd",104 question: ` Heâs your first love. I intend to be your last, however long it takes`,105 choices: [106 { choice: "Elijah", isCorrect: false },107 { choice: "Damon", isCorrect: false },108 { choice: "Stefan", isCorrect: false },109 { choice: "Klaus", isCorrect: true },110 ],111 },112 {113 id: "11",114 category: "originals",115 question: `What did the Mikaelson family swear to themselves?`,116 choices: [117 { choice: "Love is Power", isCorrect: false },118 { choice: "Family is power", isCorrect: true },119 { choice: "Friendship is power", isCorrect: false },120 { choice: "Vampirism is power", isCorrect: false },121 ],122 },123 {124 id: "12",125 category: "originals",126 question: `What is the weapon that can kill an Original?`,127 choices: [128 { choice: "Silver", isCorrect: false },129 { choice: "White Oak Stake", isCorrect: true },130 { choice: "Dagger", isCorrect: false },131 { choice: "WereWolf Blood", isCorrect: false },132 ],133 },134 {135 id: "13",136 category: "originals",137 question: `How did Klaus first discover that he was a vampire and a werewolf?`,138 choices: [139 { choice: "His mother Esther told him.", isCorrect: false },140 {141 choice: "He activated the werewolf curse after his first kill.",142 isCorrect: true,143 },144 {145 choice:146 "Werewolf daddy came around and whisked them away to be a happy family.",147 isCorrect: false,148 },149 { choice: "He transformed during the full moon.", isCorrect: false },150 ],151 },152 {153 id: "14",154 category: "originals",155 question: `What were the names of the Harvest Girls?`,156 choices: [157 { choice: " Sophie, Agnes, Eva and Davina", isCorrect: false },158 { choice: "Regina, Gretchen, Karen, and Davina", isCorrect: false },159 { choice: "Monique, Cassie, Abigail, and Davina", isCorrect: true },160 { choice: "Victoria, Melanie, Geri, and Davina", isCorrect: false },161 ],162 },163 {164 id: "15",165 category: "originals",166 question: `What were Hayleyâs parting words to her deceased husband Jackson?`,167 choices: [168 { choice: "Youâre the wolf whoâs been watching me.", isCorrect: false },169 { choice: "Till death do us part.", isCorrect: true },170 {171 choice: "I promise you. I will make all of them suffer.",172 isCorrect: false,173 },174 { choice: "To be your family.", isCorrect: false },175 ],176 },177 {178 id: "16",179 category: "originals",180 question: `Which dark object was not used against Klaus?`,181 choices: [182 { choice: "The Rosary of Madness", isCorrect: true },183 { choice: "Papa Tundeâs Blade", isCorrect: false },184 { choice: "The Golden Dagger", isCorrect: false },185 { choice: "White Oak Stake", isCorrect: false },186 ],187 },188 {189 id: "17",190 category: "originals",191 question: `Who was the Wooden Knight originally intended for?`,192 choices: [193 { choice: "Rebekah", isCorrect: false },194 { choice: " Esther", isCorrect: false },195 { choice: "Elijah", isCorrect: false },196 { choice: "Mikael", isCorrect: true },197 ],198 },199 {200 id: "18",201 category: "originals",202 question: `Which of these places does NOT appear on the show?`,203 choices: [204 { choice: "The Abattoir", isCorrect: false },205 { choice: " St. Anneâs Church", isCorrect: false },206 { choice: "Rolling Hills Asylum", isCorrect: true },207 { choice: "Rousseauâs", isCorrect: false },208 ],209 },210 {211 id: "19",212 category: "originals",213 question: `Which dark object trapped Tristan? `,214 choices: [215 { choice: "The Devilâs Star", isCorrect: false },216 { choice: " The Cursed Shackles", isCorrect: false },217 { choice: "The Serratura", isCorrect: true },218 { choice: "Needle of Sorrows", isCorrect: false },219 ],220 },221 {222 id: "20",223 category: "originals",224 question: `How many times has Klaus killed Mikael?`,225 choices: [226 { choice: "One", isCorrect: false },227 { choice: " Two", isCorrect: true },228 { choice: "Three", isCorrect: false },229 { choice: "Too many times to count", isCorrect: false },230 ],231 },232 {233 id: "21",234 category: "legacies",235 question: ` What Is The Name Of The School Where The Legacies Attend?`,236 choices: [237 {238 choice: "The Saltzman Boarding School For The Young & Gifted",239 isCorrect: false,240 },241 {242 choice: "The Salvatore Boarding School For The Young & Talented",243 isCorrect: true,244 },245 {246 choice: "The Saltzman Boarding School For The Young & Talented",247 isCorrect: false,248 },249 {250 choice: "The Salvatore Boarding School For The Young & Gifted",251 isCorrect: false,252 },253 ],254 },255 {256 id: "22",257 category: "legacies",258 question: ` You have such a big heart. Itâs okay to let other people see it`,259 choices: [260 { choice: "Emma", isCorrect: false },261 { choice: "Dorian", isCorrect: false },262 { choice: "Jo", isCorrect: true },263 { choice: "Alaric", isCorrect: false },264 ],265 },266 {267 id: "23",268 category: "legacies",269 question: `I care too much. Itâs kind of a problem`,270 choices: [271 { choice: "Lizzie", isCorrect: false },272 { choice: "Josie", isCorrect: true },273 { choice: "Hope", isCorrect: false },274 { choice: "Landon", isCorrect: false },275 ],276 },277 {278 id: "24",279 category: "legacies",280 question: `For one, rules are meant to be broken. For two, I am an equal opportunity evil temptress`,281 choices: [282 { choice: "Lizzie", isCorrect: false },283 { choice: "Josie", isCorrect: false },284 { choice: "Penelope", isCorrect: true },285 { choice: "Hope", isCorrect: false },286 ],287 },288 {289 id: "25",290 category: "legacies",291 question: `Which of these monsters was the first one to attack the Salvatore school ?`,292 choices: [293 { choice: "Gargoyle", isCorrect: true },294 { choice: "A monsterous spider", isCorrect: false },295 { choice: "A huge wolf", isCorrect: false },296 { choice: "A dragon", isCorrect: false },297 ],298 },299 {300 id: "26",301 category: "legacies",302 question: `How is Dorian connected to Stefan Salvatore?`,303 choices: [304 { choice: "Dorian's life was saved by Stefan", isCorrect: false },305 { choice: "Dorian's family was killed by Stefan", isCorrect: true },306 { choice: "They are relatives", isCorrect: false },307 { choice: "Dorian is part of his sire line", isCorrect: false },308 ],309 },310 {311 id: "27",312 category: "legacies",313 question: `Killing which of these activated Hopeâs werewolf qualities ?`,314 choices: [315 { choice: "Declan, her mother's boyfriend", isCorrect: true },316 { choice: "A man called Bill", isCorrect: false },317 { choice: "Davina Claire", isCorrect: false },318 { choice: "Landon, a student of the Salvatore School", isCorrect: false },319 ],320 },321 {322 id: "28",323 category: "legacies",324 question: `What species is Malivore?`,325 choices: [326 { choice: "Demon", isCorrect: false },327 { choice: "Golem", isCorrect: true },328 { choice: "Vampire", isCorrect: false },329 { choice: "Werewolf", isCorrect: false },330 ],331 },332 {333 id: "29",334 category: "legacies",335 question: `Who is Landonâs mother?`,336 choices: [337 { choice: "Yasmin", isCorrect: false },338 { choice: "Alaina", isCorrect: false },339 { choice: "Yara", isCorrect: false },340 { choice: "Seylah", isCorrect: true },341 ],342 },343 {344 id: "30",345 category: "legacies",346 question: `Why did Lizzie get paralyzed?`,347 choices: [348 { choice: "She got bit by a spider", isCorrect: true },349 { choice: "She got attacked by a vampire", isCorrect: false },350 { choice: "She got injured by a warewolf", isCorrect: false },351 { choice: "She got scratched by gargoyle", isCorrect: false },352 ],353 },354 {355 id: "31",356 category: "teenwolf",357 question: `What Was Stiles Stilinksi's Real Name?`,358 choices: [359 { choice: "Stanis", isCorrect: false },360 { choice: "Mieczyslaw", isCorrect: true },361 { choice: "Cuauhtemoc", isCorrect: false },362 { choice: "Aristoteles", isCorrect: false },363 ],364 },365 {366 id: "32",367 category: "teenwolf",368 question: `In the deadpool, how much is Jordan Parrish worth?`,369 choices: [370 { choice: "$5 million", isCorrect: true },371 { choice: "$10 million", isCorrect: false },372 { choice: "$15 million", isCorrect: false },373 { choice: "$25 million", isCorrect: false },374 ],375 },376 {377 id: "33",378 category: "teenwolf",379 question: `What was the name of mental asylum in Beacon Hills?`,380 choices: [381 { choice: "Lichen House", isCorrect: false },382 { choice: "Eichen House", isCorrect: true },383 { choice: "Hale House", isCorrect: false },384 { choice: "Salcombe Home", isCorrect: false },385 ],386 },387 {388 id: "34",389 category: "teenwolf",390 question: `Who said âLife Canât Ever Be All Bad Or All Good. You Know, Eventually, Things Have To Come Back To The Middle.â `,391 choices: [392 { choice: "Stiles", isCorrect: false },393 { choice: "Noah", isCorrect: false },394 { choice: "Lydia", isCorrect: false },395 { choice: "Scott", isCorrect: true },396 ],397 },398 {399 id: "35",400 category: "teenwolf",401 question: `Who said âEven When A Leader Thinks They Have Nothing Left To Give, Thereâs Still One Thing: Hope. Give Them Hope.â `,402 choices: [403 { choice: "Stiles", isCorrect: false },404 { choice: "Noah", isCorrect: false },405 { choice: "Melissa", isCorrect: true },406 { choice: "Rafael", isCorrect: false },407 ],408 },409 {410 id: "36",411 category: "teenwolf",412 question: `Who said âThereâs No Such Thing As Fate.â `,413 choices: [414 { choice: "Allison", isCorrect: true },415 { choice: "Stiles", isCorrect: false },416 { choice: "Lydia", isCorrect: false },417 { choice: "Derek", isCorrect: false },418 ],419 },420 {421 id: "37",422 category: "teenwolf",423 question: `Melissa McCall, under the guidance of Chris Argent, gathers the Nine Herbs in order heal the injuries sustained by the latter. What is the binding agent that Chris refers to as âMilâ?â `,424 choices: [425 { choice: "Oil", isCorrect: false },426 { choice: "Water", isCorrect: false },427 { choice: "Soda", isCorrect: false },428 { choice: "Honey", isCorrect: true },429 ],430 },431 {432 id: "38",433 category: "teenwolf",434 question: `Who said it: âIâm A Fan Of Ignoring A Problem Until It Just Goes Away!â `,435 choices: [436 { choice: "Allison", isCorrect: false },437 { choice: "Lydia", isCorrect: false },438 { choice: "Stiles", isCorrect: true },439 { choice: "Derek", isCorrect: false },440 ],441 },442 {443 id: "39",444 category: "teenwolf",445 question: `Where do Kira, Malia, Scott and Stiles quarantine themselves to protect the other students from shapeshifters?`,446 choices: [447 { choice: "Eichen House", isCorrect: false },448 { choice: "The Hale Vault", isCorrect: true },449 { choice: "Beacon Hills Animal Clinic", isCorrect: false },450 { choice: "Beacon Hills High School", isCorrect: false },451 ],452 },453 {454 id: "40",455 category: "teenwolf",456 question: `What is the name of the first episode?`,457 choices: [458 { choice: "Lunar Eclipse", isCorrect: false },459 { choice: "Full Moon", isCorrect: false },460 { choice: "The Bite", isCorrect: false },461 { choice: "Wolf Moon", isCorrect: true },462 ],463 },464 {465 id: "41",466 category: "twilight",467 question: `What instrument does Edward play?`,468 choices: [469 { choice: "Piano", isCorrect: true },470 { choice: "Violin", isCorrect: false },471 { choice: "Drums", isCorrect: false },472 { choice: "Guitar", isCorrect: false },473 ],474 },475 {476 id: "42",477 category: "twilight",478 question: `Which vampire was NOT turned by Carlisle Cullen?`,479 choices: [480 { choice: "Edward", isCorrect: false },481 { choice: "Esme", isCorrect: false },482 { choice: "Rosalie", isCorrect: false },483 { choice: "Jasper", isCorrect: true },484 ],485 },486 {487 id: "43",488 category: "twilight",489 question: `Which Muse song plays during the iconic Twilight baseball scene?`,490 choices: [491 { choice: "Supermassive BlackHole", isCorrect: true },492 { choice: "Time is Running Out", isCorrect: false },493 { choice: "Uprising", isCorrect: false },494 { choice: "Muscle Musium", isCorrect: false },495 ],496 },497 {498 id: "44",499 category: "twilight",500 question: `According to the books, who did James meet first?`,501 choices: [502 { choice: "Edward", isCorrect: false },503 { choice: "Bella", isCorrect: false },504 { choice: "Carlisle", isCorrect: false },505 { choice: "Alice", isCorrect: true },506 ],507 },508 {509 id: "45",510 category: "twilight",511 question: `Who killed Bree Tanner?`,512 choices: [513 { choice: "Jasper", isCorrect: false },514 { choice: "Aro", isCorrect: false },515 { choice: "Felix", isCorrect: true },516 { choice: "Jane", isCorrect: false },517 ],518 },519 {520 id: "46",521 category: "twilight",522 question: `What car did Edward buy Bella after her truck broke down?`,523 choices: [524 { choice: "A Silver Volvo", isCorrect: false },525 { choice: "A Ferrari F430", isCorrect: false },526 { choice: "A BMW M3", isCorrect: false },527 { choice: "A Mercedes Gaurdian", isCorrect: true },528 ],529 },530 {531 id: "47",532 category: "twilight",533 question: `According to Breaking Dawn, how many chromosomes does a vampire have?`,534 choices: [535 { choice: "24", isCorrect: false },536 { choice: "25", isCorrect: true },537 { choice: "26", isCorrect: false },538 { choice: "27", isCorrect: false },539 ],540 },541 {542 id: "48",543 category: "twilight",544 question: `Who was the youngest vampire in the Cullen clan (before Bella turned)?`,545 choices: [546 { choice: "Emmett", isCorrect: true },547 { choice: "Alice", isCorrect: false },548 { choice: "Esme", isCorrect: false },549 { choice: "Rosalie", isCorrect: false },550 ],551 },552 {553 id: "49",554 category: "twilight",555 question: `Who drove the van that almost hits Bella?`,556 choices: [557 { choice: "Mike", isCorrect: false },558 { choice: "Eric", isCorrect: false },559 { choice: "Quil", isCorrect: false },560 { choice: "Tyler", isCorrect: true },561 ],562 },563 {564 id: "50",565 category: "twilight",566 question: `When Jacob Black became the Alpha of his own pack, who became his Beta, or the second-in-command?`,567 choices: [568 { choice: "Quil", isCorrect: false },569 { choice: "Seth", isCorrect: false },570 { choice: "Leah", isCorrect: true },571 { choice: "Embry", isCorrect: false },572 ],573 },574];575
...
App.js
Source:App.js
1import React, { useState } from "react";2import "./App.css";3function App() {4 const [showResults, setShowResults] = useState(false);5 const [currentQuestion, setCurrentQuestion] = useState(0);6 const [score, setScore] = useState(0);7 const questions = [8 {9 text: "Which one of the following river flows between Vindhyan and Satpura ranges?",10 options: [11 { id: 0, text: "Netravati", isCorrect: false },12 { id: 1, text: "Mahanadi", isCorrect: false },13 { id: 2, text: "Son", isCorrect: false },14 { id: 3, text: "Narmada", isCorrect: true },15 ],16 },17 {18 text: "The Central Rice Research Station is situated in?",19 options: [20 { id: 0, text: "Cuttack", isCorrect: true },21 { id: 1, text: "Chennai", isCorrect: false },22 { id: 2, text: "Bangalore", isCorrect: false },23 { id: 3, text: "Quilon", isCorrect: false },24 ],25 },26 {27 text: "Who among the following wrote Sanskrit grammar?",28 options: [29 { id: 0, text: "Panini", isCorrect: true },30 { id: 1, text: "Kalidasa", isCorrect: false },31 { id: 2, text: "Charak", isCorrect: false },32 { id: 3, text: "Aryabhatt", isCorrect: false },33 ],34 },35 {36 text: "The metal whose salts are sensitive to light is?",37 options: [38 { id: 0, text: "Silver", isCorrect: true },39 { id: 1, text: "Zinc", isCorrect: false },40 { id: 2, text: "Copper", isCorrect: false },41 { id: 3, text: "Aluminum", isCorrect: false },42 ],43 },44 {45 text: "The country that has the highest in Barley Production?",46 options: [47 { id: 0, text: "Russia", isCorrect: true },48 { id: 1, text: "India", isCorrect: false },49 { id: 2, text: "France", isCorrect: false },50 { id: 3, text: "China", isCorrect: false },51 ],52 },53 {54 text: "Tsunamis are not caused by",55 options: [56 { id: 0, text: "Hurricanes", isCorrect: true },57 { id: 1, text: "Earthquakes", isCorrect: false },58 { id: 2, text: "Undersea landslides", isCorrect: false },59 { id: 3, text: "Volcanic eruptions", isCorrect: false },60 ],61 },62 {63 text: "With which of the following rivers does Chambal river merge?",64 options: [65 { id: 0, text: "Yamuna", isCorrect: true },66 { id: 1, text: "Narmada", isCorrect: false },67 { id: 2, text: "Ganga", isCorrect: false },68 { id: 3, text: "Banas", isCorrect: false },69 ],70 },71 {72 text: "Where was the electricity supply first introduced in India",73 options: [74 { id: 0, text: "Darjeeling", isCorrect: true },75 { id: 1, text: "Chennai", isCorrect: false },76 { id: 2, text: "Dehradun", isCorrect: false },77 { id: 3, text: "Mumbai", isCorrect: false },78 ],79 },80 {81 text: "Which one of the following ports is the oldest port in India?",82 options: [83 { id: 0, text: " Chennai Port", isCorrect: true },84 { id: 1, text: " Mumbai Port", isCorrect: false },85 { id: 2, text: "Kolkata Port", isCorrect: false },86 { id: 3, text: "Vishakhapatnam Port", isCorrect: false },87 ],88 },89 {90 text: "At which one of the following places do the rivers Alaknanda and Bhagirathi merge to form Ganga?",91 options: [92 { id: 0, text: "Devprayag", isCorrect: true },93 { id: 1, text: " Rudra Prayag", isCorrect: false },94 { id: 2, text: "Karnaprayag", isCorrect: false },95 { id: 3, text: "Vishnuprayag", isCorrect: false },96 ],97 },98 {99 text: "Which of the following is the capital of Arunachal Pradesh?",100 options: [101 { id: 0, text: "Itanagar", isCorrect: true },102 { id: 1, text: "Dispur", isCorrect: false },103 { id: 2, text: "Imphal", isCorrect: false },104 { id: 3, text: "Panaji", isCorrect: false },105 ],106 },107 {108 text: "What is the state flower of Haryana?",109 options: [110 { id: 0, text: "Lotus", isCorrect: true },111 { id: 1, text: "Rhododendron", isCorrect: false },112 { id: 2, text: "Golden Shower", isCorrect: false },113 { id: 3, text: " Not declared", isCorrect: false },114 ],115 },116 {117 text: "Which is the largest coffee-producing state of India?",118 options: [119 { id: 0, text: "Karnataka", isCorrect: true },120 { id: 1, text: "Tamil Nadu", isCorrect: false },121 { id: 2, text: "Kerala", isCorrect: false },122 { id: 3, text: "Arunachal Pradesh", isCorrect: false },123 ],124 },125 {126 text: "Which state has the largest area?",127 options: [128 { id: 0, text: "Rajasthan", isCorrect: true },129 { id: 1, text: "Maharashtra", isCorrect: false },130 { id: 2, text: " Madhya Pradesh", isCorrect: false },131 { id: 3, text: "Uttar Pradesh", isCorrect: false },132 ],133 },134 {135 text: " In what state is Elephant Falls located?",136 options: [137 { id: 0, text: "Meghalaya", isCorrect: true },138 { id: 1, text: "Mizoram", isCorrect: false },139 { id: 2, text: "Manipur", isCorrect: false },140 { id: 3, text: "Orissa", isCorrect: false },141 ],142 },143 ];144 const optionClicked = (isCorrect) => {145 if (isCorrect) {146 setScore(score + 1);147 }148 if (currentQuestion + 1 < questions.length) {149 setCurrentQuestion(currentQuestion + 1);150 } else {151 setShowResults(true);152 }153 };154 const restartGame = () => {155 setScore(0);156 setCurrentQuestion(0);157 setShowResults(false);158 };159 let number = (score / questions.length) * 100;160 return (161 <div className="App">162 <h1> Quiz </h1>163 <h2 className="score">164 Score: {score} <br /> {number.toFixed()}%{" "}165 </h2>166 {showResults ? (167 <div className="final-results">168 <h1>Final Results</h1>169 <h2>170 {score} out of {questions.length} correct171 </h2>172 <h2>({number.toFixed()}%)</h2>173 <button onClick={() => restartGame()}>Restart game</button>174 </div>175 ) : (176 <div className="question-card">177 <h2>178 Question: {currentQuestion + 1} out of {questions.length}179 </h2>180 <h3 className="question-text">{questions[currentQuestion].text}</h3>181 <ul>182 {questions[currentQuestion].options.map((option) => {183 return (184 <li185 key={option.id}186 onClick={() => optionClicked(option.isCorrect)}187 >188 {option.text}189 </li>190 );191 })}192 </ul>193 </div>194 )}195 </div>196 );197}...
game-data.mock.js
Source:game-data.mock.js
1export const games = [2 {3 answers: [4 {isCorrect: true, timeSpent: 40},5 {isCorrect: true, timeSpent: 20},6 {isCorrect: false, timeSpent: 400},7 ],8 remainingAttempts: 3,9 points: -110 },11 {12 answers: [13 {isCorrect: true, timeSpent: 30},14 {isCorrect: true, timeSpent: 30},15 {isCorrect: true, timeSpent: 30},16 {isCorrect: true, timeSpent: 30},17 {isCorrect: true, timeSpent: 10},18 {isCorrect: true, timeSpent: 10},19 {isCorrect: true, timeSpent: 35},20 {isCorrect: true, timeSpent: 35},21 {isCorrect: true, timeSpent: 30},22 {isCorrect: true, timeSpent: 30}23 ],24 remainingAttempts: 4,25 points: 1226 },27 {28 answers: [29 {isCorrect: true, timeSpent: 60},30 {isCorrect: true, timeSpent: 60},31 {isCorrect: true, timeSpent: 60},32 {isCorrect: true, timeSpent: 60},33 {isCorrect: true, timeSpent: 60},34 {isCorrect: true, timeSpent: 40},35 {isCorrect: false, timeSpent: 50},36 {isCorrect: true, timeSpent: 40},37 {isCorrect: true, timeSpent: 40},38 {isCorrect: false, timeSpent: 40}39 ],40 remainingAttempts: 2,41 points: 442 },43 {44 answers: [45 {isCorrect: false, timeSpent: 10},46 {isCorrect: false, timeSpent: 10},47 {isCorrect: false, timeSpent: 10},48 {isCorrect: false, timeSpent: 10}49 ],50 remainingAttempts: 0,51 points: -152 },53 {54 answers: [],55 remainingAttempts: 4,56 points: -157 }58];59export const statisctics = [20, 8, 4];60export const gamesToTestInScoreboard = [61 {62 answers: [63 {isCorrect: true, timeSpent: 40},64 {isCorrect: false, timeSpent: 20},65 {isCorrect: false, timeSpent: 400},66 ],67 remainingAttempts: 2,68 result: `ÐÑÐµÐ¼Ñ Ð²ÑÑло!<br>ÐÑ Ð½Ðµ ÑÑпели оÑгадаÑÑ Ð²Ñе мелодии`69 },70 {71 answers: [72 {isCorrect: true, timeSpent: 100},73 {isCorrect: false, timeSpent: 10},74 {isCorrect: false, timeSpent: 10},75 {isCorrect: false, timeSpent: 10},76 {isCorrect: false, timeSpent: 10}77 ],78 remainingAttempts: 0,79 result: `У Ð²Ð°Ñ Ð·Ð°ÐºÐ¾Ð½ÑилиÑÑ Ð²Ñе попÑÑки.<br>ÐиÑего, повезÑÑ Ð² ÑледÑÑÑий Ñаз!`80 },81 {82 answers: [83 {isCorrect: true, timeSpent: 20},84 {isCorrect: true, timeSpent: 20},85 {isCorrect: true, timeSpent: 20},86 {isCorrect: true, timeSpent: 20},87 {isCorrect: true, timeSpent: 20},88 {isCorrect: true, timeSpent: 20},89 {isCorrect: true, timeSpent: 20},90 {isCorrect: true, timeSpent: 20},91 {isCorrect: true, timeSpent: 20},92 {isCorrect: true, timeSpent: 20}93 ],94 remainingAttempts: 4,95 result: `ÐÑ Ð·Ð°Ð½Ñли 2-ое меÑÑо из 4 игÑоков. ÐÑо лÑÑÑе Ñем Ñ 50% игÑоков`96 },97 {98 answers: [99 {isCorrect: true, timeSpent: 10},100 {isCorrect: true, timeSpent: 10},101 {isCorrect: true, timeSpent: 10},102 {isCorrect: true, timeSpent: 10},103 {isCorrect: true, timeSpent: 10},104 {isCorrect: true, timeSpent: 10},105 {isCorrect: true, timeSpent: 10},106 {isCorrect: true, timeSpent: 10},107 {isCorrect: true, timeSpent: 100},108 {isCorrect: true, timeSpent: 100}109 ],110 remainingAttempts: 4,111 result: `ÐÑ Ð·Ð°Ð½Ñли 3-ое меÑÑо из 5 игÑоков. ÐÑо лÑÑÑе Ñем Ñ 40% игÑоков`112 },113 {114 answers: [115 {isCorrect: true, timeSpent: 30},116 {isCorrect: true, timeSpent: 30},117 {isCorrect: true, timeSpent: 30},118 {isCorrect: true, timeSpent: 30},119 {isCorrect: true, timeSpent: 30},120 {isCorrect: true, timeSpent: 30},121 {isCorrect: true, timeSpent: 30},122 {isCorrect: false, timeSpent: 10},123 {isCorrect: false, timeSpent: 10},124 {isCorrect: false, timeSpent: 10}125 ],126 remainingAttempts: 1,127 result: `ÐÑ Ð·Ð°Ð½Ñли 6-ое меÑÑо из 6 игÑоков. ÐÑо лÑÑÑе Ñем Ñ 0% игÑоков`128 },129 {130 answers: [131 {isCorrect: true, timeSpent: 30},132 {isCorrect: true, timeSpent: 30},133 {isCorrect: true, timeSpent: 30},134 {isCorrect: true, timeSpent: 30},135 {isCorrect: true, timeSpent: 30},136 {isCorrect: true, timeSpent: 30},137 {isCorrect: true, timeSpent: 10},138 {isCorrect: true, timeSpent: 10},139 {isCorrect: false, timeSpent: 10},140 {isCorrect: false, timeSpent: 10}141 ],142 remainingAttempts: 2,143 result: `ÐÑ Ð·Ð°Ð½Ñли 5-ое меÑÑо из 7 игÑоков. ÐÑо лÑÑÑе Ñем Ñ 29% игÑоков`144 },...
Using AI Code Generation
1const isCorrect = () => true;2describe('test3', () => {3 it('should pass', () => {4 expect(isCorrect()).toBe(true);5 });6});7const isCorrect = () => true;8describe('test4', () => {9 it('should pass', () => {10 expect(isCorrect()).toBe(true);11 });12});13const isCorrect = () => true;14describe('test5', () => {15 it('should pass', () => {16 expect(isCorrect()).toBe(true);17 });18});19const isCorrect = () => true;20describe('test6', () => {21 it('should pass', () => {22 expect(isCorrect()).toBe(true);23 });24});25const isCorrect = () => true;26describe('test7', () => {27 it('should pass', () => {28 expect(isCorrect()).toBe(true);29 });30});31const isCorrect = () => true;32describe('test8', () => {33 it('should pass', () => {34 expect(isCorrect()).toBe(true);35 });36});37const isCorrect = () => true;38describe('test9', () => {39 it('should pass', () => {40 expect(isCorrect()).toBe(true);41 });42});
Using AI Code Generation
1const fc = require('fast-check');2const isCorrect = require('fast-check/test/check/arbitrary/Helpers.ts').isCorrect;3fc.assert(4 fc.property(fc.string(), (str) => {5 const str1 = str + 'a';6 const str2 = str + 'b';7 return isCorrect(str1, str2);8 })9);10const fc = require('fast-check');11const isCorrect = require('fast-check/test/check/arbitrary/Helpers.ts').isCorrect;12fc.assert(13 fc.property(fc.string(), (str) => {14 const str1 = str + 'a';15 const str2 = str + 'b';16 return isCorrect(str1, str2);17 })18);19const isCorrect = require('../Helpers.js').isCorrect;
Using AI Code Generation
1const { isCorrect } = require("fast-check");2const { frequency } = require("fast-check");3const { oneof } = require("fast-check");4const { constantFrom } = require("fast-check");5const { record } = require("fast-check");6const { array } = require("fast-check");7const { tuple } = require("fast-check");8const { string } = require("fast-check");9const { double } = require("fast-check");10const { integer } = require("fast-check");11const { option } = require("fast-check");12const { mapToConstant } = require("fast-check");13const { map } = require("fast-check");14const { cloneMethod } = require("fast-check");15const { hasCloneMethod } = require("fast-check");16const { convertFromNext } = require("fast-check");17const { convertToNext } = require("fast-check");18const { cloneMethodFromNext } = require("fast-check");19const { hasCloneMethodFromNext } = require("fast-check");20const { convertFromNextWithShrink } = require("fast-check");21const { convertToNextWithShrink } = require("fast-check");22const { cloneMethodFromNextWithShrink } = require("fast-check");23const { hasCloneMethodFromNextWithShrink } = require("fast-check");24const { convertFromNextWithBias } = require("fast-check");25const { convertToNextWithBias } = require("fast-check");26const { cloneMethodFromNextWithBias } = require("fast-check");27const { hasCloneMethodFromNextWithBias } = require("fast-check");28const { convertFromNextWithShrinkAndBias } = require("fast-check");29const { convertToNextWithShrinkAndBias } = require("fast-check");30const { cloneMethodFromNextWithShrinkAndBias } = require("fast-check");31const { hasCloneMethodFromNextWithShrinkAndBias } = require("fast-check");32const { convertFromNextWithClone } = require("fast-check");33const { convertToNextWithClone } = require("fast-check");34const { cloneMethodFromNextWithClone } = require("fast-check");35const { hasCloneMethodFromNextWithClone } = require("fast-check
Using AI Code Generation
1const {isCorrect} = require("./NextArbitrary");2const isCorrectTest = (value, arb) => {3 const result = isCorrect(value, arb);4 console.log(`isCorrect(${JSON.stringify(value)}, ${arb}) => ${result}`);5};6const arb = {7 generate: () => "hello",8 canShrinkWithoutContext: () => false,9 shrink: () => [],10};11isCorrectTest("hello", arb);12isCorrectTest("hello world", arb);13isCorrectTest(5, arb);14isCorrectTest(null, arb);15isCorrect("hello", [object Object]) => true16isCorrect("hello world", [object Object]) => false17isCorrect(5, [object Object]) => false18isCorrect(null, [object Object]) => false19import { isCorrect } from “fast-check”;20const isCorrectTest = (value, arb) => {21 const result = isCorrect(value, arb);22 console.log(`isCorrect(${JSON.stringify(value)}, ${arb}) => ${result}`);23};24const arb = {25 generate: () => “hello”,26 canShrinkWithoutContext: () => false,27 shrink: () => [],28};29isCorrectTest(“hello”, arb);30isCorrectTest(“hello world”, arb);31isCorrectTest(5, arb);32isCorrectTest(null, arb);33isCorrect(“hello”, [object Object]) => true34isCorrect(“hello world”, [object Object]) => false35isCorrect(5, [object Object]) => false36isCorrect(null, [object Object]) => false
Using AI Code Generation
1import { isCorrect } from 'fast-check';2const test = isCorrect(5);3console.log(test);4import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary';5const test = isCorrect(5);6console.log(test);7import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.js';8const test = isCorrect(5);9console.log(test);10import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.ts';11const test = isCorrect(5);12console.log(test);13import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.d.ts';14const test = isCorrect(5);15console.log(test);16import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.js';17const test = isCorrect(5);18console.log(test);19import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.d.ts';20const test = isCorrect(5);21console.log(test);22import { isCorrect } from 'fast-check/src/check/arbitrary/Arbitrary.ts';23const test = isCorrect(5
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!