|
@@ -119,6 +119,210 @@ suite('eventify:', () => { |
|
|
})
|
|
|
})
|
|
|
|
|
|
suite('NaN:', () => {
|
|
|
setup(done => {
|
|
|
const emitter = eventify(NaN)
|
|
|
|
|
|
Object.keys(events).forEach(key => {
|
|
|
emitter.on(events[key], spooks.fn({
|
|
|
name: key,
|
|
|
log: log
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
emitter.on(events.end, done)
|
|
|
})
|
|
|
|
|
|
test('end event occurred once', () => {
|
|
|
assert.strictEqual(log.counts.end, 1)
|
|
|
})
|
|
|
|
|
|
test('end event was dispatched correctly', () => {
|
|
|
assert.lengthOf(log.args.end[0], 1)
|
|
|
assert.isUndefined(log.args.end[0][0])
|
|
|
})
|
|
|
|
|
|
test('array event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.array, 0)
|
|
|
})
|
|
|
|
|
|
test('object event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.object, 0)
|
|
|
})
|
|
|
|
|
|
test('property event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.property, 0)
|
|
|
})
|
|
|
|
|
|
test('string event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.string, 0)
|
|
|
})
|
|
|
|
|
|
test('number event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.number, 0)
|
|
|
})
|
|
|
|
|
|
test('literal event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.literal, 0)
|
|
|
})
|
|
|
|
|
|
test('endArray event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endArray, 0)
|
|
|
})
|
|
|
|
|
|
test('endObject event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endObject, 0)
|
|
|
})
|
|
|
|
|
|
test('error event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.error, 0)
|
|
|
})
|
|
|
|
|
|
test('dataError event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.dataError, 0)
|
|
|
})
|
|
|
|
|
|
test('endPrefix event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endPrefix, 0)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
suite('Infinity:', () => {
|
|
|
setup(done => {
|
|
|
const emitter = eventify(Infinity)
|
|
|
|
|
|
Object.keys(events).forEach(key => {
|
|
|
emitter.on(events[key], spooks.fn({
|
|
|
name: key,
|
|
|
log: log
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
emitter.on(events.end, done)
|
|
|
})
|
|
|
|
|
|
test('end event occurred once', () => {
|
|
|
assert.strictEqual(log.counts.end, 1)
|
|
|
})
|
|
|
|
|
|
test('end event was dispatched correctly', () => {
|
|
|
assert.lengthOf(log.args.end[0], 1)
|
|
|
assert.isUndefined(log.args.end[0][0])
|
|
|
})
|
|
|
|
|
|
test('array event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.array, 0)
|
|
|
})
|
|
|
|
|
|
test('object event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.object, 0)
|
|
|
})
|
|
|
|
|
|
test('property event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.property, 0)
|
|
|
})
|
|
|
|
|
|
test('string event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.string, 0)
|
|
|
})
|
|
|
|
|
|
test('number event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.number, 0)
|
|
|
})
|
|
|
|
|
|
test('literal event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.literal, 0)
|
|
|
})
|
|
|
|
|
|
test('endArray event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endArray, 0)
|
|
|
})
|
|
|
|
|
|
test('endObject event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endObject, 0)
|
|
|
})
|
|
|
|
|
|
test('error event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.error, 0)
|
|
|
})
|
|
|
|
|
|
test('dataError event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.dataError, 0)
|
|
|
})
|
|
|
|
|
|
test('endPrefix event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endPrefix, 0)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
suite('Number.NEGATIVE_INFINITY:', () => {
|
|
|
setup(done => {
|
|
|
const emitter = eventify(Number.NEGATIVE_INFINITY)
|
|
|
|
|
|
Object.keys(events).forEach(key => {
|
|
|
emitter.on(events[key], spooks.fn({
|
|
|
name: key,
|
|
|
log: log
|
|
|
}))
|
|
|
})
|
|
|
|
|
|
emitter.on(events.end, done)
|
|
|
})
|
|
|
|
|
|
test('end event occurred once', () => {
|
|
|
assert.strictEqual(log.counts.end, 1)
|
|
|
})
|
|
|
|
|
|
test('end event was dispatched correctly', () => {
|
|
|
assert.lengthOf(log.args.end[0], 1)
|
|
|
assert.isUndefined(log.args.end[0][0])
|
|
|
})
|
|
|
|
|
|
test('array event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.array, 0)
|
|
|
})
|
|
|
|
|
|
test('object event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.object, 0)
|
|
|
})
|
|
|
|
|
|
test('property event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.property, 0)
|
|
|
})
|
|
|
|
|
|
test('string event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.string, 0)
|
|
|
})
|
|
|
|
|
|
test('number event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.number, 0)
|
|
|
})
|
|
|
|
|
|
test('literal event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.literal, 0)
|
|
|
})
|
|
|
|
|
|
test('endArray event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endArray, 0)
|
|
|
})
|
|
|
|
|
|
test('endObject event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endObject, 0)
|
|
|
})
|
|
|
|
|
|
test('error event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.error, 0)
|
|
|
})
|
|
|
|
|
|
test('dataError event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.dataError, 0)
|
|
|
})
|
|
|
|
|
|
test('endPrefix event did not occur', () => {
|
|
|
assert.strictEqual(log.counts.endPrefix, 0)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
suite('function:', () => {
|
|
|
setup(done => {
|
|
|
const emitter = eventify(() => {})
|