Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af7d3de

Browse files
committed
Started the ARP call testing, not passing test yet.
1 parent 5743d71 commit af7d3de

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

app/imports/server/api/arp.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Meteor } from 'meteor/meteor';
2+
import { chai } from 'meteor/practicalmeteor:chai';
3+
import { HTTP } from 'meteor/http'
4+
import '../../../server/api/endpoints.js';
5+
import '../../../server/secret/routers.js';
6+
7+
const address = 'http://localhost:3100';
8+
const key = 'v1';
9+
const arpTable = 'arp';
10+
const name = 'candra';
11+
const authToken = 'Bearer abcd';
12+
13+
describe('arp', function() {
14+
it('accepts correct call', function() {
15+
HTTP.call(
16+
'POST',
17+
address + '/routerapi/v1/arp/' + name,
18+
{headers: {'Authorization': authToken}, body: {}},
19+
function(error, result) {
20+
console.log(result);
21+
chai.assert(!error,'there was an error: \n' + error);
22+
chai.assert.equal(result.statusCode,200,'Status code didn\'t match 200 it was ' + result.statusCode);
23+
}
24+
);
25+
});
26+
});

app/server/api/endpoints.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ RouterApi.addRoute(
1313
{
1414
post() {
1515

16+
console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
17+
1618
var ARPEntries = App.Collections.ARPEntries;
1719
var APICalls = App.Collections.APICalls;
1820
var request = this.request;
@@ -21,6 +23,8 @@ RouterApi.addRoute(
2123
var routers = App.routers;
2224
var router = _.findWhere(routers, {name: this.urlParams.name});
2325

26+
console.log('routers: ' + App.routers);
27+
2428
if (!router) {
2529
return {
2630
statusCode: 404,

0 commit comments

Comments
 (0)