Files
cgm-remote-monitor/tests/api3.basic.test.js
T
cfdbaa8bbd APIv3: wrapping all results in JSON (#6703)
* APIv3: isolating documents from tests (not allowing clashes of calculated identifiers)

* removing unused async keyword

* fixing api v3 swagger and moving it to /api3-docs

* APIv3: adding cachedCollection stub of cachedCollection storage implementation

* APIv3: mongo cachedCollection storage implementation

* APIv3: testing and debugging cache updates

* APIv3: more testing on cache updates

* APIv3: fixing bad async functions

* APIv3: finishing cache invalidation tests

* APIv3: wrapping VERSION result

* APIv3: wrapping STATUS result

* APIv3: wrapping DELETE result

* APIv3: wrapping READ result + partially SEARCH and HISTORY

* APIv3: wrapping CREATE result

* APIv3: wrapping UPDATE + PATCH result

* APIv3: wrapping LAST MODIFIED result

* APIv3: updating swagger doc

* APIv3: updating tutorial.md

* APIv3: tuning tests

* APIv3: merge dev

Co-authored-by: Petr Ondrusek <petr.ondrusek@seznam.cz>
Co-authored-by: Petr Ondrůšek <petr.ondrusek@okin.eu>
Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-07 22:58:23 +02:00

43 lines
994 B
JavaScript

'use strict';
const request = require('supertest');
require('should');
describe('Basic REST API3', function() {
const self = this
, testConst = require('./fixtures/api3/const.json')
, instance = require('./fixtures/api3/instance')
;
this.timeout(15000);
before(async () => {
self.instance = await instance.create({});
self.app = self.instance.app;
self.env = self.instance.env;
});
after(function after () {
self.instance.ctx.bus.teardown();
});
it('GET /version', async () => {
let res = await request(self.app)
.get('/api/v3/version')
.expect(200);
const apiConst = require('../lib/api3/const.json')
, software = require('../package.json')
, result = res.body.result;
res.body.status.should.equal(200);
result.version.should.equal(software.version);
result.apiVersion.should.equal(apiConst.API3_VERSION);
result.srvDate.should.be.within(testConst.YEAR_2019, testConst.YEAR_2050);
});
});