Socket
Socket
Sign inDemoInstall

node-ocpi

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

.github/workflows/npm-publish.yml

4

package.json
{
"name": "node-ocpi",
"version": "1.0.4",
"version": "1.0.5",
"description": "An OCPI library for Node.js",

@@ -13,3 +13,3 @@ "main": "index.js",

"joi": "^17.4.2",
"node-ocpi": "^1.0.3"
"node-ocpi": "^1.0.4"
},

@@ -16,0 +16,0 @@ "keywords": [

@@ -1,8 +0,11 @@

const { CDR, Location } = require('./CDR');
const { CDR } = require('./CDR');
const { Location } = require('./Location');
describe('CDR Model', () => {
it('should validate a correct CDR object', () => {
const location = new Location('loc1', 'ON_STREET', 'Main Street Charging Station',
it('validates a correct CDR instance', () => {
const location = new Location(
'loc1', 'ON_STREET', 'Main Street Charging Station',
'123 Main St', 'Anytown', '12345', 'USA',
{ latitude: 52.520008, longitude: 13.404954 });
{ latitude: 52.520008, longitude: 13.404954 }
);
const cdr = new CDR(

@@ -15,5 +18,10 @@ 'cdr1', new Date(), new Date(), 'token1', 'WHITELIST', location,

it('should throw an error for invalid data', () => {
it('throws an error for incorrect CDR instance', () => {
const location = new Location(
'loc1', 'ON_STREET', 'Main Street Charging Station',
'123 Main St', 'Anytown', '12345', 'USA',
{ latitude: 52.520008, longitude: 13.404954 }
);
const cdr = new CDR(
'', new Date(), new Date(), '', '', null, '', '', '', '', 0, []
'', '', '', '', '', location, '', '', '', '', 0, []
);

@@ -20,0 +28,0 @@ expect(() => cdr.validate()).toThrow();

const { Command } = require('./Command');
describe('Command Model', () => {
it('should validate a correct Command object', () => {
it('validates a correct Command instance', () => {
const command = new Command(

@@ -12,3 +12,3 @@ 'cmd1', 'START_TRANSACTION',

it('should throw an error for invalid data', () => {
it('throws an error for incorrect Command instance', () => {
const command = new Command(

@@ -15,0 +15,0 @@ '', 'INVALID_TYPE', {}

@@ -15,3 +15,3 @@ const Joi = require('joi');

this.tariff_id = String(tariff_id);
this.last_updated = new Date(last_updated).toISOString();
this.last_updated = new Date(last_updated);
this.terms_and_conditions = String(terms_and_conditions);

@@ -18,0 +18,0 @@ this.phase_to_phase_voltage = Number(phase_to_phase_voltage);

const { Connector } = require('./Connector');
describe('Connector Model', () => {
it('should validate a correct Connector object', () => {
it('validates a correct Connector instance', () => {
const connector = new Connector(
'1', 'IEC_62196_T2', 'CABLE', 'AC_3_PHASE', 400, 16, 22,
new Date().toISOString()
new Date()
);

@@ -12,5 +12,5 @@ expect(() => connector.validate()).not.toThrow();

it('should throw an error for invalid data', () => {
it('throws an error for incorrect Connector instance', () => {
const connector = new Connector(
'', '', '', '', 0, 0, 0, ''
'', '', '', '', 0, 0, 0, new Date()
);

@@ -17,0 +17,0 @@ expect(() => connector.validate()).toThrow();

@@ -19,3 +19,3 @@ const Joi = require('joi');

this.charging_when_closed = Boolean(charging_when_closed);
this.last_updated = new Date(last_updated).toISOString();
this.last_updated = new Date(last_updated);
this.energy_mix = energy_mix || {};

@@ -22,0 +22,0 @@ this.accessibility = String(accessibility);

const { EVSE } = require('./EVSE');
describe('EVSE Model', () => {
it('should validate a correct EVSE object', () => {
it('validates a correct EVSE instance', () => {
const evse = new EVSE(
'evse1', 'loc1', 'AVAILABLE', ['CHADEMO'],
{ latitude: 52.520008, longitude: 13.404954 }, '1', new Date().toISOString()
{ latitude: 52.520008, longitude: 13.404954 },
'1', new Date()
);

@@ -12,5 +13,5 @@ expect(() => evse.validate()).not.toThrow();

it('should throw an error for invalid data', () => {
it('throws an error for incorrect EVSE instance', () => {
const evse = new EVSE(
'', '', 'INVALID', [], {}, '', ''
'', '', 'INVALID', [], {}, '', new Date()
);

@@ -17,0 +18,0 @@ expect(() => evse.validate()).toThrow();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc