Skip to content

Commit

Permalink
Added cases that reproduce the "send 0" problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
weekens committed Jan 10, 2021
1 parent 1545f9a commit b80c1e7
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"devDependencies": {
"@types/bson": "^1.0.11",
"@types/supertest": "^2.0.7",
"@types/is-running": "^2.1.0",
"chai": "^3.5.0",
"chai-like": "^0.1.10",
"cross-env": "^5.2.0",
Expand Down
9 changes: 0 additions & 9 deletions test-resources/ts-resources/types/is-running.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/typescript/test-clustered-actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {afterEach} from 'mocha';
import * as tu from '../../lib/utils/test';
import * as actors from '../../index';
import {expect} from 'chai';
import * as isRunning from 'is-running';
import isRunning = require('is-running');
import * as P from 'bluebird';
import * as _ from 'underscore';

Expand Down
19 changes: 18 additions & 1 deletion test/typescript/test-forked-actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {afterEach} from 'mocha';
import * as tu from '../../lib/utils/test';
import * as actors from '../../index';
import {expect} from 'chai';
import * as isRunning from 'is-running';
import isRunning = require('is-running');
import * as P from 'bluebird';
import * as _ from 'underscore';
import * as http from 'http';
Expand Down Expand Up @@ -464,6 +464,23 @@ describe('ForkedActor', function() {
expect(result).to.be.equal('HELLO!');
expect(localCounter).to.be.equal(1);
});

it('should correctly send numeric parameters', async function() {
/**
* Test actor class.
*/
class TestActor {
printNumber(n: number): string {
return `${n}`;
}
}

let actor = await rootActor.createChild(TestActor, { mode: 'forked' });

let result = await actor.sendAndReceive('printNumber', 0);

expect(result).to.be.equal('0');
});
});

describe('send()', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/typescript/test-remote-actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {afterEach} from 'mocha';
import * as tu from '../../lib/utils/test';
import * as actors from '../../index';
import {expect} from 'chai';
import * as isRunning from 'is-running';
import isRunning = require('is-running');
import * as P from 'bluebird';
import * as _ from 'underscore';

Expand Down
19 changes: 18 additions & 1 deletion test/typescript/test-threaded-actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ActorSystem, Actor, ActorRef} from '../../index';
import {afterEach} from 'mocha';
import * as actors from '../../index';
import {expect} from 'chai';
import * as isRunning from 'is-running';
import isRunning = require('is-running');
import * as P from 'bluebird';
import * as _ from 'underscore';
import * as common from '../../lib/utils/common.js';
Expand Down Expand Up @@ -374,6 +374,23 @@ describe('ThreadedActor', function () {
expect(result).to.be.equal('HELLO!');
expect(localCounter).to.be.equal(1);
});

it('should correctly send numeric parameters', async function() {
/**
* Test actor class.
*/
class TestActor {
printNumber(n: number): string {
return `${n}`;
}
}

let actor = await rootActor.createChild(TestActor, { mode: 'threaded' });

let result = await actor.sendAndReceive('printNumber', 0);

expect(result).to.be.equal('0');
});
});

describe('send()', function () {
Expand Down

0 comments on commit b80c1e7

Please sign in to comment.