Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from paulcbetts/channel-change-rtm
Update channel unreads via RTM
- Loading branch information
Showing
10 changed files
with
138 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function isObject(o: any): boolean { | ||
return o === Object(o); | ||
} | ||
|
||
export function isFunction(o: any): boolean { | ||
return !!(o && o.constructor && o.call && o.apply); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Observable } from 'rxjs/Observable'; | ||
|
||
import { MergeStrategy } from '../../src/lib/updatable'; | ||
import { InMemorySparseMap, SparseMap } from '../../src/lib/sparse-map'; | ||
import { TestClass, expect } from '../support'; | ||
|
||
export type ValueFactoryFunction = | ||
((key: string, hint?: any) => Observable<Object>); | ||
export type CreateFixtureFunction = | ||
((factory: ValueFactoryFunction, strategy: MergeStrategy) => SparseMap<string, Object>); | ||
|
||
function testsForClass(Klass: Function, createFixture: CreateFixtureFunction) { | ||
const name = Klass.name; | ||
|
||
describe(`The ${name} class interface implementation`, function() { | ||
it ('smoke tests successfully', function() { | ||
let fixture = createFixture(() => Observable.of(new TestClass()), 'overwrite'); | ||
|
||
let result = fixture.listen('foo'); | ||
expect((result.value as TestClass).derived).to.equal(42); | ||
}); | ||
|
||
it ('creates Updatables with Merge Strategy semantics', function() { | ||
let fixture = createFixture(() => Observable.of({a: 1}), 'merge'); | ||
|
||
let result = fixture.listen('foo'); | ||
expect(result.value).to.deep.equal({a: 1}); | ||
|
||
result.next({b: 2}); | ||
expect(result.value).to.deep.equal({a: 1, b: 2}); | ||
}); | ||
}); | ||
} | ||
|
||
testsForClass(InMemorySparseMap, (factory, strategy) => { | ||
return new InMemorySparseMap(factory, strategy); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters