Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/kopi.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,11 @@ class Kopi

"Kopi#{milk}#{coffeeLevel}#{sugarLevel}#{ice}"

dabao: (kopi, serve = 'packet') ->
# WARNING: plastic cup might charge extra 20 cent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol

if /\b(plastic cup|packet)\b/.test(serve)
'Da bao ' + kopi + ', ' + serve + '!'
else
'Da bao ' + kopi + '... talk cock only la'

module.exports = new Kopi
20 changes: 20 additions & 0 deletions test/kopi_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,23 @@ describe 'Kopi', ->
coffee: .5
sugar: 0
expect(name).to.equal 'Kopi C Kosong'

describe '#dabao', ->
kopi = Kopi.stringify
condensed_milk: .2
water: .4
coffee: .4
sugar: 1

it 'dabaos Kopi in a bag with a straw', ->
dabao = Kopi.dabao(kopi)
expect(dabao).to.equal 'Da bao Kopi, packet!'

it 'dabaos Kopi in a plastic cup', ->
dabao = Kopi.dabao(kopi, 'plastic cup')
expect(dabao).to.equal 'Da bao Kopi, plastic cup!'

it 'dabaos Kopi in the mouth', ->
dabao = Kopi.dabao(kopi, 'mouth')
expect(dabao).to.equal 'Da bao Kopi... talk cock only la'