Skip to content

Commit

Permalink
feat: implement mailbox with redis stream
Browse files Browse the repository at this point in the history
This PR implements the mailbox of actor model with redis stream

Ref: #62
  • Loading branch information
Keith-CY committed Dec 12, 2022
1 parent 266ff19 commit ac49039
Show file tree
Hide file tree
Showing 13 changed files with 484 additions and 172 deletions.
139 changes: 139 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion packages/models/__tests__/actor/actor-reference.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from '@jest/globals'
import { ActorReference, InvalidPathException } from '../../src'
import { ActorReference, InvalidActorURIException, InvalidPathException } from '../../src'

describe(`Test Actor Reference`, () => {
describe(`should have specific attributes`, () => {
Expand Down Expand Up @@ -71,4 +71,34 @@ describe(`Test Actor Reference`, () => {
})
})
})

describe('Test ActorReference#fromURI', () => {
it(`uri has protocol, path, and name`, () => {
const REF = {
name: 'test_name',
path: '/test_path/',
protocol: 'http',
uri: `http://test_path/test_name`,
}
expect(ActorReference.fromURI(REF.uri).json).toEqual(REF)
})

it(`uri has protocol and name without path`, () => {
const REF = {
protocol: 'local',
path: '/',
name: 'test_name',
uri: 'local://test_name',
}
expect(ActorReference.fromURI(REF.uri).json).toEqual(REF)
})

it(`should thown when uri has invalid protocol`, () => {
try {
ActorReference.fromURI('local:/test_name')
} catch (e) {
expect(e).toBeInstanceOf(InvalidActorURIException)
}
})
})
})
Loading

0 comments on commit ac49039

Please sign in to comment.