-
Notifications
You must be signed in to change notification settings - Fork 0
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 #12 from RobDWaller/unit-tests
Unit tests
- Loading branch information
Showing
26 changed files
with
288 additions
and
62 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
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
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
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,55 @@ | ||
import DateTime from '../../src/js/helper/date-time.js' | ||
|
||
test('Get date time object', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.getDate()).toBeInstanceOf(Date) | ||
}) | ||
|
||
test('Get unix timestamp', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.getUnixTimestamp()).toBe(Math.floor(Date.now() / 1000)) | ||
}) | ||
|
||
test('Get timestamp minus days', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.getUnixTimestampMinusDays(3)).toBe(date.getUnixTimestamp() - (3 * 24 * 3600)) | ||
}) | ||
|
||
test('Convert one day to seconds', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.convertDaysToSeconds(1)).toBe(3600*24) | ||
}) | ||
|
||
test('Convert zero days to seconds', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.convertDaysToSeconds(0)).toBe(0) | ||
}) | ||
|
||
test('Convert five days to seconds', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.convertDaysToSeconds(5)).toBe((3600*24)*5) | ||
}) | ||
|
||
test('Get tableau time string', () => { | ||
let date = new DateTime() | ||
|
||
expect(date.getTableauTimeString('2018-08-05T07:00:00+0000')).toBe('2018-08-05 07:00:00') | ||
}) | ||
|
||
test('Get tableau time string convert zero', () => { | ||
let date = new DateTime() | ||
|
||
expect(() => {date.getTableauTimeString('0')}).toThrowError('Invalid Facebook date string') | ||
}) | ||
|
||
test('Get tableau time string convert empty', () => { | ||
let date = new DateTime() | ||
|
||
expect(() => {date.getTableauTimeString('')}).toThrowError('Invalid Facebook date string') | ||
}) |
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,17 @@ | ||
import PageMeta from '../../src/js/mapper/page-meta.js' | ||
|
||
test('Make page meta class', () => { | ||
let pageMeta = new PageMeta([]) | ||
|
||
expect(pageMeta).toBeInstanceOf(PageMeta) | ||
}) | ||
|
||
test('Make page meta class fail', () => { | ||
expect(() => {new PageMeta()}).toThrow() | ||
}) | ||
|
||
test('Get Tableau data fail', () => { | ||
let pageMeta = new PageMeta(null) | ||
|
||
expect(() => {pageMeta.getTableauData()}).toThrow() | ||
}) |
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,17 @@ | ||
import PageMetrics from '../../src/js/mapper/page-metrics.js' | ||
|
||
test('Make page metrics class', () => { | ||
let pageMetrics = new PageMetrics([]) | ||
|
||
expect(pageMetrics).toBeInstanceOf(PageMetrics) | ||
}) | ||
|
||
test('Make page metrics class fail', () => { | ||
expect(() => {new PageMetrics()}).toThrow() | ||
}) | ||
|
||
test('Get Tableau data fail', () => { | ||
let pageMetrics = new PageMetrics(null) | ||
|
||
expect(() => {pageMetrics.getTableauData()}).toThrow() | ||
}) |
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,17 @@ | ||
import PostMeta from '../../src/js/mapper/post-meta.js' | ||
|
||
test('Make post meta class', () => { | ||
let postMeta = new PostMeta([]) | ||
|
||
expect(postMeta).toBeInstanceOf(PostMeta) | ||
}) | ||
|
||
test('Make post meta class fail', () => { | ||
expect(() => {new PostMeta()}).toThrow() | ||
}) | ||
|
||
test('Get Tableau data fail', () => { | ||
let postMeta = new PostMeta(null) | ||
|
||
expect(() => {postMeta.getTableauData()}).toThrow() | ||
}) |
Oops, something went wrong.