This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12135 from brave/woi-ref-params
Send week of installation and ref parameter to updater
- Loading branch information
Showing
5 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* global describe, it, before, after */ | ||
|
||
const assert = require('assert') | ||
const sinon = require('sinon') | ||
let dates | ||
|
||
require('../../braveUnit') | ||
|
||
describe('update date handling', function () { | ||
const exampleDate = 1510708981887 // Tuesday November 14th 2017, 6:23:01 PM | ||
const exampleDate2 = 1512304291746 // Monday December 04th 2017, 9:18:11 AM | ||
let fakeClock | ||
before(function () { | ||
fakeClock = sinon.useFakeTimers(exampleDate) | ||
dates = require('../../../../app/dates') | ||
}) | ||
after(function () { | ||
fakeClock.restore() | ||
}) | ||
|
||
describe('todayYMD', function () { | ||
it('returns YYYY-MM-DD of today', function () { | ||
assert.equal(dates.todayYMD(), '2017-11-14', 'today') | ||
}) | ||
}) | ||
|
||
describe('todayWOY', function () { | ||
it('returns the ISO week number for today', function () { | ||
assert.equal(dates.todayWOY(), 314, 'ISO week number') | ||
}) | ||
}) | ||
|
||
describe('todayMonth', function () { | ||
it('returns the month of today as a number', function () { | ||
assert.equal(dates.todayMonth(), 11, 'Month of today') | ||
}) | ||
}) | ||
|
||
describe('lastMonday', function () { | ||
it('returns YYYY-MM-DD of closest Monday in the past to current date', function () { | ||
const d = new Date(exampleDate) | ||
assert.equal(dates.lastMonday(d), '2017-11-13', 'previous Monday') | ||
}) | ||
it('returns YYYY-MM-DD of today if today is monday', function () { | ||
const d = new Date(exampleDate2) | ||
assert.equal(dates.lastMonday(d), '2017-12-04', 'today is Monday') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters