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 * Overrides method for setting config to check if endpoint is correct for hourly
* *
* @param config * @param {object} config The configuration object
*/ */
setConfig(config) { setConfig(config) {
this.config = 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 * Overrides method for setting config with checks for the precipitationValue being unset or invalid
* *
* @param config * @param {object} config The configuration object
*/ */
setConfig(config) { setConfig(config) {
this.config = 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. * 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 * @param {object[]} times Array of time objects
* @returns {undefined} * @returns {object} The weatherdata closest to the current time
*/ */
getClosestToCurrentTime(times) { getClosestToCurrentTime(times) {
let now = moment(); let now = moment();
@ -87,7 +87,7 @@ WeatherProvider.register("smhi", {
/** /**
* Get the forecast url for the configured coordinates * Get the forecast url for the configured coordinates
* *
* @returns {string} * @returns {string} the url for the specified coordinates
*/ */
getURL() { getURL() {
let lon = this.config.lon; let lon = this.config.lon;
@ -100,8 +100,8 @@ WeatherProvider.register("smhi", {
* The returned units is always in metric system. * 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. * 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 {object} weatherData Weatherdata to convert
* @param coordinates * @param {object} coordinates Coordinates of the locations of the weather
* @returns {WeatherObject} * @returns {WeatherObject}
*/ */
convertWeatherDataToObject(weatherData, coordinates) { convertWeatherDataToObject(weatherData, coordinates) {
@ -146,7 +146,7 @@ WeatherProvider.register("smhi", {
* Takes all of the data points and converts it to one WeatherObject per day. * Takes all of the data points and converts it to one WeatherObject per day.
* *
* @param allWeatherData * @param allWeatherData
* @param coordinates * @param {object} coordinates
* @returns {*[]} * @returns {*[]}
*/ */
convertWeatherDataGroupedByDay(allWeatherData, coordinates) { 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) * Resolve coordinates from the response data (probably preferably to use this if it's not matching the config values exactly)
* *
* @param data * @param {object} data Response data from the weather service
* @returns {{lon, lat}} * @returns {{lon, lat}} the lat/long coordinates of the data
*/ */
resolveCoordinates(data) { resolveCoordinates(data) {
return { lat: data.geometry.coordinates[0][1], lon: data.geometry.coordinates[0][0] }; 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. * 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. * Find these gaps and fill them with the previous hours data to make the data returned a complete set.
* *
* @param data * @param {object[]} data Response data from the weather service
* @returns {*[]} * @returns {object[]} Given data with filled gaps
*/ */
fillInGaps(data) { fillInGaps(data) {
let result = []; let result = [];
@ -238,8 +238,8 @@ WeatherProvider.register("smhi", {
* Helper method to fetch a property from the returned data set. * Helper method to fetch a property from the returned data set.
* The returned values is an array with always one value in it. * The returned values is an array with always one value in it.
* *
* @param currentWeatherData * @param {object} weatherData Weatherdata to fetch from
* @param name * @param {string} name The name of the property
* @returns {unknown} * @returns {unknown}
*/ */
paramValue(currentWeatherData, name) { paramValue(currentWeatherData, name) {

View File

@ -1,7 +1,8 @@
const _ = require("lodash"); 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 = {}) { function generateWeather(extendedData = {}) {
return JSON.stringify( return JSON.stringify(

View File

@ -1,7 +1,8 @@
const _ = require("lodash"); 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 = {}) { function generateWeatherForecast(extendedData = {}) {
return JSON.stringify( return JSON.stringify(

View File

@ -13,7 +13,9 @@ describe("Weather module", function () {
helpers.setupTimeout(this); 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) { async function setup(responses) {
app = await helpers.startApplication({ 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) { async function getElement(element) {
return await app.client.$(element); return await app.client.$(element);
} }
/** /**
* @param element * @param {string} element css selector
* @param result * @param {string} result Expected text in given selector
* @returns {Promise<boolean>} Promise with True if the text matches
*/ */
async function getText(element, result) { async function getText(element, result) {
const elem = await getElement(element); const elem = await getElement(element);