Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+27
@@ -0,0 +1,27 @@
|
||||
var servify = require("./..");
|
||||
var assert = require("assert");
|
||||
|
||||
describe("Servify", function(){
|
||||
it("must be able to create a service and call its functions", function(){
|
||||
|
||||
// Creates service
|
||||
var count = 0;
|
||||
return servify.api(7171, {
|
||||
square: (x) => x * x,
|
||||
concat: (a, b) => a.concat(b),
|
||||
count: () => ++count
|
||||
}).then(() => {
|
||||
|
||||
// Uses service
|
||||
var lib = servify.at("http://localhost:7171");
|
||||
return Promise.all([
|
||||
lib.square(3).then(x => assert.equal(x, 9)),
|
||||
lib.concat([1,2],[3,4]).then(x => assert.equal(JSON.stringify(x), "[1,2,3,4]")),
|
||||
lib.count().then(x => assert.equal(JSON.stringify(x), "1"))
|
||||
]);
|
||||
|
||||
}).catch(function(err){
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user