-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquiz.test.js
76 lines (73 loc) · 2.17 KB
/
quiz.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { findBestMatch } from './logic.js';
// Define some test cases
const testCases = [
{
description: "High Honesty-Humility and High Conscientiousness",
scores: {
"Honesty-Humility": 4.7,
"Emotionality": 2.0,
"Extraversion": 2.5,
"Agreeableness": 3.5,
"Conscientiousness": 4.5,
"Openness to Experience": 3.0
},
expectedPokemon: "Pokémon X"
},
{
description: "Low Emotionality and High Openness",
scores: {
"Honesty-Humility": 3.0,
"Emotionality": 1.5,
"Extraversion": 3.0,
"Agreeableness": 2.5,
"Conscientiousness": 2.0,
"Openness to Experience": 4.8
},
expectedPokemon: "Pokémon Y"
},
{
description: "Balanced Traits with a Slight Tilt Towards Extraversion",
scores: {
"Honesty-Humility": 3.0,
"Emotionality": 3.0,
"Extraversion": 4.0,
"Agreeableness": 3.0,
"Conscientiousness": 3.0,
"Openness to Experience": 3.0
},
expectedPokemon: "Pokémon Z"
},
{
description: "High Agreeableness and Low Honesty-Humility",
scores: {
"Honesty-Humility": 1.5,
"Emotionality": 2.5,
"Extraversion": 3.2,
"Agreeableness": 4.6,
"Conscientiousness": 3.1,
"Openness to Experience": 2.9
},
expectedPokemon: "Pokémon W"
},
{
description: "Very Low Scores Across All Traits",
scores: {
"Honesty-Humility": 1.0,
"Emotionality": 1.0,
"Extraversion": 1.0,
"Agreeableness": 1.0,
"Conscientiousness": 1.0,
"Openness to Experience": 1.0
},
expectedPokemon: "Pokémon V"
}
];
function runTests() {
testCases.forEach(testCase => {
console.log(`Testing: ${testCase.description}`);
const scores = testCase.scores;
const bestMatch = findBestMatch(scores);
console.log(`Best match for ${testCase.description}: ${bestMatch.name}`);
});
}
runTests();