Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit a799367

Browse files
author
Ruben Schmidmeister
committed
Implement dilibert oracle
1 parent ef22587 commit a799367

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

algorithms/dilbert-oracle.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Troll: Nine nine nine nine nine nine
2+
const random = () => 9
3+
module.exports = random

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
const fairDiceRoll = require('./algorithms/fair-dice-roll')
2-
module.exports = Object.assign(fairDiceRoll, { fairDiceRoll })
2+
const dilibertOracle = require('./algorithms/dilbert-oracle')
3+
module.exports = Object.assign(fairDiceRoll, { fairDiceRoll, dilibertOracle })

test/dilbert-oracle.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict'
2+
3+
const assert = require('assert')
4+
const { dilibertOracle } = require('../index')
5+
6+
describe('dilibert oracle', () => {
7+
it('always returns the same number', () => {
8+
assert.equal(9, dilibertOracle())
9+
})
10+
})

test/fair-dice-roll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const { fairDiceRoll } = require('../index')
55

66
describe('fair dice roll', () => {
77
it('always returns the same number', () => {
8-
assert.equal(fairDiceRoll(), fairDiceRoll())
8+
assert.equal(4, fairDiceRoll())
99
})
1010
})

0 commit comments

Comments
 (0)