nock = require 'nock' expect = require("chai").should() Asjon = require '../asjon-testing.coffee' asjon = undefined describe 'modulo memes', -> before (done) -> # Inizializzo robot Asjon (assa) -> asjon = assa after asjon.after afterEach asjon.clear require('../scripts/memes.coffee')(asjon.robot) done() it "dovrebbe generare correttamente l'url dell'immagine", (done) -> questions = [ "asjon meme fry, not sure if this works, or not" ] acc = 0 asjon.receive (e,l) -> l.join().should.equal 'http://memegen.link/fry/not_sure_if_this_works/or_not.jpg' acc++ if acc is questions.length then done() questions.map (q) -> asjon.send q it 'dovrebbe rispondere correttamente quando la domanda รจ malformata', (done) -> questions = [ "asjon meme a, b, c, d,e" "asjon meme ciao" ] acc = 0 asjon.receive (e,l) -> l.join().should.match /^richiesta malformata/g acc++ if acc is questions.length then done() questions.map (q) -> asjon.send q