signUp(newUser, function(error) { expect(error).toBeNull(); testUtils.post("/api/users/sign-up") .send(newUser) .expect(409) .end(done); });
it('should convert markdown to HTML', function (done) { testUtils.post('/convert') .send('# Header One') .set('Content-Type', 'text/x-markdown') .set('Accept', 'text/html') .expect(200) .end(function (error, res) { expect(error).notToExist() expect('<h1 id="header-one">Header One</h1>').toEqual(res.text.trim()) done() }) })
it('should have the flickr & youtube pipeline middleware', function (done) { testUtils.post('/convert') /* eslint max-len:0 */ .send('<youtube href="http://www.youtube.com/embed/K27MA8v91D4"></youtube>\n<flickrshow href="https://www.flickr.com/photos/88096431@N00/sets/72157645234728466/"></flickrshow>') .set('Content-Type', 'text/x-markdown') .set('Accept', 'text/html') .expect(200) .end(function (error, res) { expect(error).notToExist() var $ = cheerio.load(res.text) expect($('youtube')).toHaveLength(0) expect($('iframe')).toHaveLength(2) expect($('flickrshow')).toHaveLength(0) expect($('object')).toHaveLength(0) done() }) })
it("should 401 an anonymous user", function(done) { testUtils.post("/api/users/key") .expect(401, done); });
it("should 400 incomplete credentials", function(done) { testUtils.post("/api/users/sign-up") .send(user) .expect(400) .end(done); });