implemented Observablemap
This commit is contained in:
35
test/test.js
35
test/test.js
File diff suppressed because one or more lines are too long
34
test/test.ts
34
test/test.ts
@ -1,13 +1,18 @@
|
||||
import 'typings-test'
|
||||
import lik = require('../dist/index')
|
||||
import * as events from 'events'
|
||||
import * as rx from 'rxjs/Rx'
|
||||
import * as should from 'should'
|
||||
|
||||
import lik = require('../dist/index')
|
||||
describe('lik',function(){
|
||||
describe('Stringmap',function(){
|
||||
let testStringmap: lik.Stringmap
|
||||
let testString1 = 'testString1'
|
||||
let testString2 = 'testString2'
|
||||
let testString3 = 'testString3'
|
||||
let testString4 = 'testString4'
|
||||
let testString5 = 'testString5'
|
||||
let testString6 = 'testString6'
|
||||
it('should create an instance of Stringmap',function(){
|
||||
testStringmap = new lik.Stringmap()
|
||||
should(testStringmap).be.instanceof(lik.Stringmap)
|
||||
@ -26,6 +31,10 @@ describe('lik',function(){
|
||||
should(testStringmap.checkMinimatch('*String2')).be.true()
|
||||
should(testStringmap.checkMinimatch('*String4')).be.false()
|
||||
})
|
||||
it('should add an array of strings',function(){
|
||||
testStringmap.addStringArray([testString4,testString5,testString6])
|
||||
should(testStringmap.checkMinimatch('*String4')).be.true()
|
||||
})
|
||||
it('should remove a string from Stringmap',function(){
|
||||
testStringmap.removeString(testString2)
|
||||
should(testStringmap.checkString(testString2)).be.false()
|
||||
@ -86,4 +95,27 @@ describe('lik',function(){
|
||||
should(myObject === referenceObject).be.true()
|
||||
})
|
||||
})
|
||||
describe('Observablemap',function(){
|
||||
let testObservablemap: lik.Observablemap
|
||||
let testObservable1: rx.Observable<any>
|
||||
let testObservable2: rx.Observable<any>
|
||||
let testObservable3: rx.Observable<any>
|
||||
let testEmitter: events.EventEmitter
|
||||
it('should create an instance',function(){
|
||||
testObservablemap = new lik.Observablemap()
|
||||
should(testObservablemap).be.instanceof(lik.Observablemap)
|
||||
})
|
||||
it('should accept a new emitter',function(done) {
|
||||
testEmitter = new events.EventEmitter()
|
||||
testObservable1 = testObservablemap.getObservableForEmitterEvent(testEmitter,'event1')
|
||||
testObservable1.subscribe(x => {
|
||||
done()
|
||||
})
|
||||
testObservable2 = testObservablemap.getObservableForEmitterEvent(testEmitter,'event1')
|
||||
testObservable3 = testObservablemap.getObservableForEmitterEvent(testEmitter, 'event2')
|
||||
should(testObservable1 === testObservable2).be.true()
|
||||
should(testObservable1 === testObservable3).be.false()
|
||||
testEmitter.emit('event1')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user