This commit is contained in:
2018-03-20 08:16:54 +01:00
parent a28c96356f
commit bafa94c6ac
23 changed files with 151 additions and 67 deletions

View File

@ -2,35 +2,46 @@
import { expect, tap } from 'tapbundle';
import * as smartuniverse from '../ts/index';
import { Observable } from 'rxjs';
let testUniverse: smartuniverse.Universe;
let testUniverseClient: smartuniverse.UniverseClient
let testUniverseClient: smartuniverse.UniverseClient;
let testMessageObservable: Observable<smartuniverse.UniverseMessage>;
tap.test('first test', async () => {
testUniverse = new smartuniverse.Universe({
messageExpiryInMilliseconds: 5000
messageExpiryInMilliseconds: 1000
});
});
tap.test('add a message to the SmartUniverse', async () => {
await testUniverse.initServer(8765);
})
});
// testing message handling
tap.test('create smartuniverse client', async () => {
testUniverseClient = new smartuniverse.UniverseClient({
serverAddress: 'http://localhost:8765'
});
expect(testUniverseClient).to.be.instanceof(smartuniverse.UniverseClient)
})
expect(testUniverseClient).to.be.instanceof(smartuniverse.UniverseClient);
});
tap.test('should send a message correctly', async () => {
await testUniverseClient.sendMessage('greeting', {
anyBool: true
})
})
});
});
tap.test('should get a obsevable correctly', async () => {
testMessageObservable = testUniverseClient.getMessageObservable();
});
tap.test('should receive a message correctly', async () => {
// TODO:
});
tap.test('should end the server correctly', async () => {
await testUniverse.stopServer();
})
});
tap.start();