Update jsdocs

This commit is contained in:
rejas 2021-08-01 09:53:28 +02:00
parent ae3d552ad7
commit cd18794fca
5 changed files with 27 additions and 20 deletions

View File

@ -89,7 +89,7 @@ WeatherProvider.register("openweathermap", {
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param config
* @param {object} config The configuration object
*/
setConfig(config) {
this.config = config;

View File

@ -56,7 +56,7 @@ WeatherProvider.register("smhi", {
/**
* Overrides method for setting config with checks for the precipitationValue being unset or invalid
*
* @param config
* @param {object} config The configuration object
*/
setConfig(config) {
this.config = config;
@ -69,8 +69,8 @@ WeatherProvider.register("smhi", {
/**
* Of all the times returned find out which one is closest to the current time, should be the first if the data isn't old.
*
* @param times
* @returns {undefined}
* @param {object[]} times Array of time objects
* @returns {object} The weatherdata closest to the current time
*/
getClosestToCurrentTime(times) {
let now = moment();
@ -87,7 +87,7 @@ WeatherProvider.register("smhi", {
/**
* Get the forecast url for the configured coordinates
*
* @returns {string}
* @returns {string} the url for the specified coordinates
*/
getURL() {
let lon = this.config.lon;
@ -100,8 +100,8 @@ WeatherProvider.register("smhi", {
* The returned units is always in metric system.
* Requires coordinates to determine if its daytime or nighttime to know which icon to use and also to set sunrise and sunset.
*
* @param weatherData
* @param coordinates
* @param {object} weatherData Weatherdata to convert
* @param {object} coordinates Coordinates of the locations of the weather
* @returns {WeatherObject}
*/
convertWeatherDataToObject(weatherData, coordinates) {
@ -146,7 +146,7 @@ WeatherProvider.register("smhi", {
* Takes all of the data points and converts it to one WeatherObject per day.
*
* @param allWeatherData
* @param coordinates
* @param {object} coordinates
* @returns {*[]}
*/
convertWeatherDataGroupedByDay(allWeatherData, coordinates) {
@ -194,8 +194,8 @@ WeatherProvider.register("smhi", {
/**
* Resolve coordinates from the response data (probably preferably to use this if it's not matching the config values exactly)
*
* @param data
* @returns {{lon, lat}}
* @param {object} data Response data from the weather service
* @returns {{lon, lat}} the lat/long coordinates of the data
*/
resolveCoordinates(data) {
return { lat: data.geometry.coordinates[0][1], lon: data.geometry.coordinates[0][0] };
@ -215,8 +215,8 @@ WeatherProvider.register("smhi", {
* The distance between the data points is increasing in the data the more distant the prediction is.
* Find these gaps and fill them with the previous hours data to make the data returned a complete set.
*
* @param data
* @returns {*[]}
* @param {object[]} data Response data from the weather service
* @returns {object[]} Given data with filled gaps
*/
fillInGaps(data) {
let result = [];
@ -238,8 +238,8 @@ WeatherProvider.register("smhi", {
* Helper method to fetch a property from the returned data set.
* The returned values is an array with always one value in it.
*
* @param currentWeatherData
* @param name
* @param {object} weatherData Weatherdata to fetch from
* @param {string} name The name of the property
* @returns {unknown}
*/
paramValue(currentWeatherData, name) {

View File

@ -1,7 +1,8 @@
const _ = require("lodash");
/**
* @param extendedData
* @param {object} extendedData extra data to add to the default mock data
* @returns {string} mocked current weather data
*/
function generateWeather(extendedData = {}) {
return JSON.stringify(

View File

@ -1,7 +1,8 @@
const _ = require("lodash");
/**
* @param extendedData
* @param {object} extendedData extra data to add to the default mock data
* @returns {string} mocked forecast weather data
*/
function generateWeatherForecast(extendedData = {}) {
return JSON.stringify(

View File

@ -13,7 +13,9 @@ describe("Weather module", function () {
helpers.setupTimeout(this);
/**
* @param responses
*
* @param {object} responses mocked data to be returned
* @returns {Promise} Resolved once the electron app is started
*/
async function setup(responses) {
app = await helpers.startApplication({
@ -27,15 +29,18 @@ describe("Weather module", function () {
}
/**
* @param element
*
* @param {string} element css selector
* @returns {Promise<Element>} Promise with the element once it is rendered
*/
async function getElement(element) {
return await app.client.$(element);
}
/**
* @param element
* @param result
* @param {string} element css selector
* @param {string} result Expected text in given selector
* @returns {Promise<boolean>} Promise with True if the text matches
*/
async function getText(element, result) {
const elem = await getElement(element);