https://github.com/roppa/oca
OCA Personality test
https://github.com/roppa/oca
Last synced: 8 months ago
JSON representation
OCA Personality test
- Host: GitHub
- URL: https://github.com/roppa/oca
- Owner: roppa
- Created: 2016-07-31T16:47:02.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-31T16:47:20.000Z (almost 10 years ago)
- Last Synced: 2025-02-14T18:36:29.115Z (over 1 year ago)
- Language: JavaScript
- Size: 37.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#The OCA test
This is a personality test used by the Cof$. I found it fascinating so wanted to create a digital version.
It can be used interactively via the terminal via:
```
node index.js
```
As a package, create a new instance of the OCA test with:
```
let oca = new OCA({ age: 25, sex: 'm' });
```
##Method getQuestion
Takes an integer between 1-200 representing one of the 200 questions. Added in case the form is going to be random.
```
oca.getQuestion(3);
```
It returns an object:
```
{
id: 2,
question: 'Is it hard on you when you fail?'
}
```
##Method answer:
Takes an id and a value. Answers are 'y', 'm', 'n', for 'yes', 'maybe', and 'no'.
```
oca.answer(2, 'y');
```
Returns true or throws an error if invalid values.
##Method generateResults:
```
oca.generateResults();
```
Returns false if some answers are missing. Returns object with raw and percentile properties if test has been completed. The obeject has two properties, raw and percentile. The percentile is used to create the chart.
```
{ raw: { a: 34, b: 55 }, percentile: { a: 34, b: 55 } };
```
##Testing
Test using Mocha:
```
mocha
```