ven-registration.spec.js 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. const { readFileSync } = require('fs');
  3. const path = require('path');
  4. const { expect } = require('chai');
  5. const { Ven } = require('../../client/ven');
  6. const app = require('../../server');
  7. const { sequelize } = require('../../db');
  8. const { port } = require('../../config');
  9. describe('VEN registration', function() {
  10. describe('successful self-registration', async function() {
  11. let ven;
  12. before(async () => {
  13. await sequelize.sync();
  14. await app.start();
  15. const clientCrtPem = readFileSync(path.join(__dirname, 'integration-client.crt'), 'utf-8');
  16. ven = new Ven(`http://127.0.0.1:${port}`, clientCrtPem, 'aabbccddeeff', '17:32:59:FD:0E:B5:99:31:27:9C', 'ven.js1');
  17. });
  18. it('should connect', async () => {
  19. const registrationResponse = await ven.register();
  20. expect(registrationResponse.vtnId).to.be.a('string');
  21. });
  22. after(async () => {
  23. await app.stop();
  24. });
  25. });
  26. });