diff --git a/lib/kopi.coffee b/lib/kopi.coffee index baab240..871d5af 100644 --- a/lib/kopi.coffee +++ b/lib/kopi.coffee @@ -120,4 +120,11 @@ class Kopi "Kopi#{milk}#{coffeeLevel}#{sugarLevel}#{ice}" + dabao: (kopi, serve = 'packet') -> + # WARNING: plastic cup might charge extra 20 cent + if /\b(plastic cup|packet)\b/.test(serve) + 'Da bao ' + kopi + ', ' + serve + '!' + else + 'Da bao ' + kopi + '... talk cock only la' + module.exports = new Kopi diff --git a/test/kopi_spec.coffee b/test/kopi_spec.coffee index db3eab4..83a6dd8 100644 --- a/test/kopi_spec.coffee +++ b/test/kopi_spec.coffee @@ -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' +