Skip to content

Commit

Permalink
Add and update some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rejas authored and veeck committed Jun 20, 2022
1 parent 02c9f19 commit d46e0aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
20 changes: 3 additions & 17 deletions tests/e2e/modules/weather_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ describe("Weather module", function () {
describe("Current weather", function () {
describe("Default configuration", function () {
beforeAll(function (done) {
startApp("tests/configs/modules/weather/currentweather_default.js", {}, done);
const sunrise = moment().startOf("day").unix();
const sunset = moment().endOf("day").unix();
startApp("tests/configs/modules/weather/currentweather_default.js", { sys: { sunrise, sunset } }, done);
});

it("should render wind speed and wind direction", function () {
Expand All @@ -61,26 +63,10 @@ describe("Weather module", function () {
it("should render feels like temperature", function () {
getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -5.6°");
});
});

describe("Default configuration with sunrise", function () {
beforeAll(function (done) {
const sunrise = moment().startOf("day").unix();
const sunset = moment().startOf("day").unix();
startApp("tests/configs/modules/weather/currentweather_default.js", { sys: { sunrise, sunset } }, done);
});

it("should render sunrise", function () {
getText(".weather .normal.medium span:nth-child(4)", "12:00 am");
});
});

describe("Default configuration with sunset", function () {
beforeAll(function (done) {
const sunrise = moment().startOf("day").unix();
const sunset = moment().endOf("day").unix();
startApp("tests/configs/modules/weather/currentweather_default.js", { sys: { sunrise, sunset } }, done);
});

it("should render sunset", function () {
getText(".weather .normal.medium span:nth-child(4)", "11:59 pm");
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/functions/weather_object_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ describe("WeatherObject", function () {
expect(weatherobject.isDayTime()).toBe(false);
});

it("should convert windspeed correctly from mph to mps", function () {
expect(Math.round(weatherobject.convertWindToMetric(93.951324266285))).toBe(42);
});

afterAll(function () {
moment.tz.setDefault(originalTimeZone);
});
Expand Down

0 comments on commit d46e0aa

Please sign in to comment.