EnAccess / EnAccess/OpenPAYGO-js

[Feature Request]: Generate JSON Test Cases for Metrics module

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
JavaScript
Stars
2
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/EnAccess/OpenPAYGO-js/blob/main/CONTRIBUTING.md) for this project, if it exists.
- [x] I agree to follow the [Code of Conduct](https://github.com/EnAccess/OpenPAYGO-js/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://github.com/EnAccess/OpenPAYGO-js/issues) for a feature request that matches the one I want to file, without success.

### Problem Description

Based on the comment on this [PR](https://github.com/EnAccess/OpenPAYGO-js/pull/43#pullrequestreview-2709885918)

It would be nice to be able to verify metrics generation with tests with JSON sample data.

i.e Having a list of sample metrics.

```json
[
{
"serial_number":"A111222",
"timestamp":1611583070,
"data":{
"token_count":13,
"tampered":false,
"firmware_version":"1.14.2"
},
"historical_data":[
{
"timestamp":1611583070,
"panel_voltage":17.5,
"battery_voltage":12.5,
"panel_current":2.2,
"battery_current":3.2
},
{
"timestamp":1611583010,
"panel_voltage":15.7,
"battery_voltage":12.6,
"panel_current":2.2,
"battery_current":3.2,
"usb_load_1_current":0.7
}
],
"data_format":{
"variables":{
"battery_current":{
"name":"Battery Current",
"type":"float",
"unit":"A",
"description":"The battery current, negative means it is charging."
}
}
}
}
]
```

### Proposed Solution

Get already generated metrics data as JSON i.e `sample_metrics.json`

Resources:
- https://github.com/openpaygo/metrics/blob/main/Specifications.md

### Alternatives Considered

No alternative considered

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.