Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #149 from otoyo/add-tests-for-getdatestr
Browse files Browse the repository at this point in the history
Add tests for getDateStr()
  • Loading branch information
otoyo authored Dec 30, 2022
2 parents 0442aa1 + 9725a65 commit 93a41dd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions __tests__/lib/blog-helper.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
jest.mock('../../lib/notion/blog-index-cache')

import {
getDateStr,
isYouTubeURL,
parseYouTubeVideoId,
} from '../../lib/blog-helpers'

describe('getDateStr', () => {
it('returns str when date has time', async () => {
const got = getDateStr('2022-12-30T00:09:00.000+09:00')
expect(got).toEqual('2022-12-30')
})

it('returns str when date has no time', async () => {
const got = getDateStr('2022-12-30')
expect(got).toEqual('2022-12-30')
})

it('returns local time str considering timezone', async () => {
const got = getDateStr('2022-12-30T00:00:00.000+09:00')
expect(got).toEqual('2022-12-30')
})
})

describe('isYouTubeURL', () => {
it('returns false with not YouTube URL', async () => {
const got = isYouTubeURL(new URL('https://www.google.com/'))
Expand Down

1 comment on commit 93a41dd

@vercel
Copy link

@vercel vercel bot commented on 93a41dd Dec 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

easy-notion-blog – ./

easy-notion-blog-git-main-otoyo.vercel.app
easy-notion-blog-otoyo.vercel.app
my-notion-blog-seven.vercel.app

Please sign in to comment.