Permalink
Browse files

All test files now passing lint tests

  • Loading branch information...
lloydwatkin committed Dec 20, 2013
1 parent 720a894 commit e17904f57125b9050562e6bd51aa0a9929cfc9ba
View
@@ -5,7 +5,7 @@ module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
- allFiles: ['gruntfile.js', 'lib/**/*.js', 'examples/**/*.js'],
+ allFiles: ['gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
jshintrc: '.jshintrc',
}
View
@@ -1,3 +1,5 @@
+'use strict';
+
var ltx = require('ltx')
, fs = require('fs')
, Event = require('events').EventEmitter
@@ -15,4 +17,5 @@ Eventer.prototype = new Event()
Eventer.prototype.send = function(stanza) {
this.emit('stanza', stanza.root())
}
-exports.Eventer = Eventer
+
+exports.Eventer = Eventer
View
@@ -1,9 +1,12 @@
+'use strict';
+
var Chat = require('../../index').Chat
, ltx = require('ltx')
, helper = require('../helper')
, should = require('should')
, chatState = require('../../index').utils['xep-0085']
+/* jshint -W030 */
describe('Chat', function() {
var chat
@@ -128,13 +131,13 @@ describe('Chat', function() {
it('https://github.com/lloydwatkin/xmpp-ftw/issues/40', function(done) {
socket.once('xmpp.chat.message', function(data) {
- data.should.eql({
- from: { domain: 'buddycloud.org', user: 'lloyd', resource: '...' },
- content: 'hey',
- format: 'plain',
- state: 'active'
- })
- done()
+ data.should.eql({
+ from: { domain: 'buddycloud.org', user: 'lloyd', resource: '...' },
+ content: 'hey',
+ format: 'plain',
+ state: 'active'
+ })
+ done()
})
chat.handle(helper.getStanza('issues/40')).should.be.true
})
@@ -145,7 +148,7 @@ describe('Chat', function() {
it('Sends error message if \'to\' parameter missing', function(done) {
socket.once('xmpp.error.client', function(data) {
- data.description.should.equal("Missing 'to' key")
+ data.description.should.equal('Missing \'to\' key')
data.type.should.equal('modify')
data.condition.should.equal('client-error')
data.request.should.eql({})
@@ -184,7 +187,7 @@ describe('Chat', function() {
var to = 'romeo@montague.net/orchard'
var content = 'This will <strong>fail'
socket.once('xmpp.error.client', function(data) {
- data.description.should.equal("Can not parse XHTML message")
+ data.description.should.equal('Can not parse XHTML message')
data.type.should.equal('modify')
data.condition.should.equal('client-error')
data.request.to.should.equal(to)
@@ -193,7 +196,9 @@ describe('Chat', function() {
done()
})
chat.sendMessage({
- to: to, content: content, format: chat.XHTML
+ to: to,
+ content: content,
+ format: chat.XHTML
})
})
@@ -216,7 +221,9 @@ describe('Chat', function() {
done()
})
chat.sendMessage({
- to: to, content: content, format: chat.XHTML
+ to: to,
+ content: content,
+ format: chat.XHTML
})
})
@@ -239,7 +246,9 @@ describe('Chat', function() {
done()
})
chat.sendMessage({
- to: to, content: content, format: chat.XHTML
+ to: to,
+ content: content,
+ format: chat.XHTML
})
})
@@ -252,7 +261,8 @@ describe('Chat', function() {
done()
})
chat.sendMessage({
- to: to, state: state
+ to: to,
+ state: state
})
})
View
@@ -1,8 +1,11 @@
+'use strict';
+
var should = require('should')
, Presence = require('../../index').Presence
, ltx = require('ltx')
, helper = require('../helper')
+/* jshint -W030 */
describe('Presence', function() {
var presence, socket, xmpp, manager
@@ -95,9 +98,9 @@ describe('Presence', function() {
data.status.should.equal('say hello to me')
data.priority.should.equal('10')
data.show.should.equal('chat')
- done()
+ done()
})
- presence.handle(helper.getStanza('presence/presence-reply'))
+ presence.handle(helper.getStanza('presence/presence-reply'))
})
})
@@ -152,7 +155,7 @@ describe('Presence', function() {
socket.once('xmpp.error.client', function(data) {
data.type.should.equal('modify')
data.condition.should.equal('client-error')
- data.description.should.equal("Missing 'to' key")
+ data.description.should.equal('Missing \'to\' key')
data.request.should.eql({})
xmpp.removeAllListeners('stanza')
done()
@@ -161,16 +164,17 @@ describe('Presence', function() {
})
it('Can send subscribe stanza', function(done) {
- var to = 'juliet@example.com/balcony'
- xmpp.once('stanza', function(stanza) {
- stanza.is('presence').should.be.true
- stanza.attrs.to.should.equal(to)
- stanza.attrs.type.should.equal('subscribe')
- stanza.attrs.from.should.equal(manager.jid)
- done()
- })
- socket.emit('xmpp.presence.subscribe', { to: to })
- })
+ var to = 'juliet@example.com/balcony'
+ xmpp.once('stanza', function(stanza) {
+ stanza.is('presence').should.be.true
+ stanza.attrs.to.should.equal(to)
+ stanza.attrs.type.should.equal('subscribe')
+ stanza.attrs.from.should.equal(manager.jid)
+ done()
+ })
+ socket.emit('xmpp.presence.subscribe', { to: to })
+ }
+ )
})
describe('Subscribed stanzas', function() {
@@ -182,7 +186,7 @@ describe('Presence', function() {
socket.once('xmpp.error.client', function(data) {
data.type.should.equal('modify')
data.condition.should.equal('client-error')
- data.description.should.equal("Missing 'to' key")
+ data.description.should.equal('Missing \'to\' key')
data.request.should.eql({})
xmpp.removeAllListeners('stanza')
done()
@@ -191,16 +195,17 @@ describe('Presence', function() {
})
it('Can send subscribed stanza', function(done) {
- var to = 'juliet@example.com/balcony'
- xmpp.once('stanza', function(stanza) {
- stanza.is('presence').should.be.true
- stanza.attrs.to.should.equal(to)
- stanza.attrs.type.should.equal('subscribed')
- stanza.attrs.from.should.equal(manager.jid)
- done()
- })
- socket.emit('xmpp.presence.subscribed', { to: to })
- })
+ var to = 'juliet@example.com/balcony'
+ xmpp.once('stanza', function(stanza) {
+ stanza.is('presence').should.be.true
+ stanza.attrs.to.should.equal(to)
+ stanza.attrs.type.should.equal('subscribed')
+ stanza.attrs.from.should.equal(manager.jid)
+ done()
+ })
+ socket.emit('xmpp.presence.subscribed', { to: to })
+ }
+ )
})
describe('Unsubscribed stanzas', function() {
@@ -212,7 +217,7 @@ describe('Presence', function() {
socket.once('xmpp.error.client', function(data) {
data.type.should.equal('modify')
data.condition.should.equal('client-error')
- data.description.should.equal("Missing 'to' key")
+ data.description.should.equal('Missing \'to\' key')
data.request.should.eql({})
xmpp.removeAllListeners('stanza')
done()
@@ -221,16 +226,17 @@ describe('Presence', function() {
})
it('Can send unsubscribed stanza', function(done) {
- var to = 'juliet@example.com/balcony'
- xmpp.once('stanza', function(stanza) {
- stanza.is('presence').should.be.true
- stanza.attrs.to.should.equal(to)
- stanza.attrs.type.should.equal('unsubscribed')
- stanza.attrs.from.should.equal(manager.jid)
- done()
- })
- socket.emit('xmpp.presence.unsubscribed', { to: to })
- })
+ var to = 'juliet@example.com/balcony'
+ xmpp.once('stanza', function(stanza) {
+ stanza.is('presence').should.be.true
+ stanza.attrs.to.should.equal(to)
+ stanza.attrs.type.should.equal('unsubscribed')
+ stanza.attrs.from.should.equal(manager.jid)
+ done()
+ })
+ socket.emit('xmpp.presence.unsubscribed', { to: to })
+ }
+ )
})
it('Presence request errors when missing \'to\'', function(done) {
@@ -240,7 +246,7 @@ describe('Presence', function() {
socket.once('xmpp.error.client', function(data) {
data.type.should.equal('modify')
data.condition.should.equal('client-error')
- data.description.should.equal("Missing 'to' key")
+ data.description.should.equal('Missing \'to\' key')
data.request.should.eql({})
xmpp.removeAllListeners('stanza')
done()
Oops, something went wrong.

0 comments on commit e17904f

Please sign in to comment.