Skip to content

Commit 32ddd4f

Browse files
Julien-MolinaNicolas ERNY
authored andcommitted
Update dependencies & Remove old code & Prepare patch 6.0.1 (#162)
1 parent 33a46ed commit 32ddd4f

8 files changed

Lines changed: 1137 additions & 1459 deletions

File tree

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reactivexcomponent.js",
3-
"version": "6.0.0",
3+
"version": "6.0.1",
44
"description": "Javascript reactive client API for XComponent",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -17,7 +17,9 @@
1717
"lint": "tslint -c tslint.json 'src/**/*.{ts,tsx}'"
1818
},
1919
"jest": {
20-
"setupTestFrameworkScriptFile": "<rootDir>/config/jest/setup.js",
20+
"setupFilesAfterEnv": [
21+
"<rootDir>/config/jest/setup.js"
22+
],
2123
"collectCoverageFrom": [
2224
"src/**/*.{js,jsx,ts,tsx}"
2325
],
@@ -66,8 +68,8 @@
6668
"homepage": "https://github.com/xcomponent/ReactiveXComponent.js",
6769
"dependencies": {
6870
"@types/es6-shim": "^0.31.32",
69-
"@types/jest": "^23.0.0",
70-
"@types/node": "^10.0.0",
71+
"@types/jest": "^24.0.0",
72+
"@types/node": "^11.0.0",
7173
"@types/pako": "^1.0.0",
7274
"@types/rx": "^4.1.1",
7375
"@types/xml2js": "0.4.3",
@@ -85,14 +87,14 @@
8587
"clean-webpack-plugin": "^1.0.0",
8688
"compression": "^1.6.2",
8789
"husky": "^1.0.0-rc.13",
88-
"jest": "^23.0.0",
89-
"jest-cli": "^23.0.0",
90+
"jest": "^24.0.0",
91+
"jest-cli": "^24.0.0",
9092
"json-loader": "^0.5.4",
9193
"mock-socket": "^8.0.1",
9294
"prettier": "^1.14.0",
9395
"pretty-quick": "^1.6.0",
9496
"source-map-loader": "^0.2.0",
95-
"ts-jest": "^23.0.0",
97+
"ts-jest": "^24.0.0",
9698
"ts-loader": "^5.0.0",
9799
"ts-mockito": "^2.3.0",
98100
"tslint": "^5.0.0",

src/communication/WebSocketConnection.test.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ describe('Test Connection module', function() {
9393
mockServer.close(undefined);
9494
});
9595
new XComponent()
96-
.connect(
97-
serverUrl,
98-
new FakeErrorHandler(err => done())
99-
)
96+
.connect(serverUrl, new FakeErrorHandler(err => done()))
10097
.then(connection => {
10198
connection.createSession(xcApiFileName);
10299
})
@@ -108,14 +105,9 @@ describe('Test Connection module', function() {
108105
// tslint:disable-next-line:typedef
109106
it('given an unknown server url, should call the error listener', function(done) {
110107
let serverUrl = 'wss://wrongServerUrl';
111-
new XComponent()
112-
.connect(
113-
serverUrl,
114-
new FakeErrorHandler(err => done())
115-
)
116-
.catch(error => {
117-
/**/
118-
});
108+
new XComponent().connect(serverUrl, new FakeErrorHandler(err => done())).catch(error => {
109+
/**/
110+
});
119111
});
120112
});
121113

@@ -130,9 +122,10 @@ describe('Test Connection module', function() {
130122
new XComponent().connect(serverUrl).then(connection => {
131123
let apiName = 'unknownApi';
132124
connection.getCompositionModel(apiName).then(compositionModel => {
133-
expect(compositionModel.projectName).not.toBe(null);
134-
expect(compositionModel.components).not.toBe(null);
135-
expect(compositionModel.composition).not.toBe(null);
125+
expect(compositionModel).not.toBe(undefined);
126+
expect(compositionModel!.projectName).not.toBe(null);
127+
expect(compositionModel!.components).not.toBe(null);
128+
expect(compositionModel!.composition).not.toBe(null);
136129
serverMock.stop(done);
137130
});
138131
});

src/communication/WebSocketSession.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
import { WebSocket } from 'mock-socket';
21
import { WebSocketSession } from '../../src/communication/WebSocketSession';
32

43
describe('Test xcSession module', function() {
54
describe('Add private topic / SetPrivateTopic', function() {
65
it('should not trigger server subscription on undefined topic', () => {
76
// tslint:disable-next-line:no-any
87
let mockWebSocket: any = {};
8+
// tslint:disable-next-line:no-any
9+
let apiConfiguration: any = {};
910
mockWebSocket.send = jest.fn();
1011
mockWebSocket.getObservable = jest.fn();
11-
const session = new WebSocketSession(mockWebSocket, null);
12+
const session = new WebSocketSession(mockWebSocket, apiConfiguration);
1213
session.privateTopics.setDefaultPublisherTopic(undefined);
1314
session.privateTopics.addSubscriberTopic(undefined);
1415
expect(mockWebSocket.send).toHaveBeenCalledTimes(1);
1516
});
1617

1718
it('Should add and set correctly the given private topics', () => {
18-
const serverUrl = 'wss:\\serverUrl';
1919
// tslint:disable-next-line:no-any
2020
let mockWebSocket: any = {};
21+
// tslint:disable-next-line:no-any
22+
let apiConfiguration: any = {};
2123
mockWebSocket.send = jest.fn();
2224
mockWebSocket.getObservable = jest.fn();
23-
const session = new WebSocketSession(mockWebSocket, null);
25+
const session = new WebSocketSession(mockWebSocket, apiConfiguration);
2426
const privateTopic = 'privateTopic';
2527
const anotherPrivateTopic = 'anotherPrivateTopic';
2628
session.privateTopics.setDefaultPublisherTopic(privateTopic);

src/communication/WebSocketSubscriber.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('Test xcWebSocketSubscriber module', function() {
119119
// tslint:disable-next-line:no-any
120120
mockServer.on('connection', function(server: any) {
121121
let n = -3;
122-
let topic: string = undefined;
122+
let topic: string = '';
123123

124124
// tslint:disable-next-line:no-any
125125
server.on('message', function(message: any) {

src/configuration/apiConfiguration.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ test('GetComponentCode throws exception when using an unkonwn component name', (
6565

6666
test('GetStateMachineCode throws exception when using an unkonwn component name', () => {
6767
const componentName = 'random component';
68+
const stateMachineName = 'random state machine';
6869
const messageError = "Component '" + componentName + "' not found";
6970
return parse()
7071
.then(config => {
71-
config.getStateMachineCode(componentName, null);
72+
config.getStateMachineCode(componentName, stateMachineName);
7273
fail();
7374
})
7475
.catch(e => expect(e.message).toBe(messageError));

src/interfaces/Connection.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { CompositionModel } from '../communication/xcomponentMessages';
22
import { Session } from './Session';
3-
import { ErrorListener } from './ErrorListener';
43

54
export interface Connection {
65
getXcApiList(): Promise<Array<string>>;
76
getCompositionModel(xcApiName: string): Promise<CompositionModel | undefined>;
8-
createSession(xcApiFileName: string, errotListener?: ErrorListener): Promise<Session>;
9-
createAuthenticatedSession(
10-
xcApiFileName: string,
11-
sessionData: string,
12-
errorListener?: ErrorListener
13-
): Promise<Session>;
7+
createSession(xcApiFileName: string): Promise<Session>;
8+
createAuthenticatedSession(xcApiFileName: string, sessionData: string): Promise<Session>;
149
dispose(): void;
1510
}

src/interfaces/PrivateTopics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class PrivateTopics {
1111
this.addSubscriberTopic(this.defaultPublisherTopic);
1212
}
1313

14-
public setDefaultPublisherTopic(newDefaultPublisherTopic: string): void {
14+
public setDefaultPublisherTopic(newDefaultPublisherTopic: string | undefined): void {
1515
if (newDefaultPublisherTopic) {
1616
this.addSubscriberTopic(newDefaultPublisherTopic);
1717
this.removeSubscriberTopic(this.defaultPublisherTopic);
@@ -23,7 +23,7 @@ export class PrivateTopics {
2323
return this.defaultPublisherTopic;
2424
}
2525

26-
public addSubscriberTopic(privateTopic: string): void {
26+
public addSubscriberTopic(privateTopic: string | undefined): void {
2727
if (privateTopic && this.subscriberTopics.indexOf(privateTopic) === -1) {
2828
this.subscriber.sendSubscribeRequestToTopic(privateTopic, Kinds.Private);
2929
this.subscriberTopics.push(privateTopic);

0 commit comments

Comments
 (0)