-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: get some tests passing and resolve linter issues
- Loading branch information
Showing
116 changed files
with
3,995 additions
and
6,501 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
12 changes: 12 additions & 0 deletions
12
src/lib/notion/BlockHandler/helpers/getSubDeckName.test.ts
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,12 @@ | ||
import getSubDeckName from './getSubDeckName'; | ||
import { CHILD_PAGE_MOCK, HEADING_MOCK } from './mocks'; | ||
|
||
describe('getSubDeckName', () => { | ||
it.each([ | ||
['name from title', { title: 'cool' }, 'cool'], | ||
['child page', CHILD_PAGE_MOCK, 'Basic blocks'], | ||
['child page', HEADING_MOCK, 'Blocks'], | ||
])('%s', (_, input, expected) => { | ||
expect(getSubDeckName(input)).toBe(expected); | ||
}); | ||
}); |
17 changes: 11 additions & 6 deletions
17
src/lib/notion/helpers/getSubDeckName.ts → ...on/BlockHandler/helpers/getSubDeckName.ts
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,70 @@ | ||
import { BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'; | ||
|
||
export const CHILD_PAGE_MOCK: BlockObjectResponse = { | ||
object: 'block', | ||
id: '3cc8d7cc-358a-46b4-a03a-1b18ff4f2d35', | ||
parent: { | ||
type: 'page_id', | ||
page_id: 'd693054c-328f-404a-9267-d78681a75bef', | ||
}, | ||
created_time: '2021-10-24T08:05:00.000Z', | ||
last_edited_time: '2022-04-23T17:11:00.000Z', | ||
created_by: { | ||
object: 'user', | ||
id: '1590db54-99fe-467c-a656-be319fe6ca8b', | ||
}, | ||
last_edited_by: { | ||
object: 'user', | ||
id: '1590db54-99fe-467c-a656-be319fe6ca8b', | ||
}, | ||
has_children: true, | ||
archived: false, | ||
type: 'child_page', | ||
child_page: { | ||
title: 'Basic blocks', | ||
}, | ||
}; | ||
|
||
export const HEADING_MOCK: BlockObjectResponse = { | ||
object: 'block', | ||
id: '02f65a53-c1af-405f-8ba9-fa9cf6933113', | ||
parent: { | ||
type: 'page_id', | ||
page_id: 'd693054c-328f-404a-9267-d78681a75bef', | ||
}, | ||
created_time: '2021-03-20T12:54:00.000Z', | ||
last_edited_time: '2021-03-20T12:55:00.000Z', | ||
created_by: { | ||
object: 'user', | ||
id: '1590db54-99fe-467c-a656-be319fe6ca8b', | ||
}, | ||
last_edited_by: { | ||
object: 'user', | ||
id: '1590db54-99fe-467c-a656-be319fe6ca8b', | ||
}, | ||
has_children: false, | ||
archived: false, | ||
type: 'heading_2', | ||
heading_2: { | ||
rich_text: [ | ||
{ | ||
type: 'text', | ||
text: { | ||
content: 'Blocks', | ||
link: null, | ||
}, | ||
annotations: { | ||
bold: false, | ||
italic: false, | ||
strikethrough: false, | ||
underline: false, | ||
code: false, | ||
color: 'default', | ||
}, | ||
plain_text: 'Blocks', | ||
href: null, | ||
}, | ||
], | ||
color: 'default', | ||
}, | ||
}; |
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
55 changes: 0 additions & 55 deletions
55
src/lib/notion/_mock/payloads/GetPageResponse/07a7b319-1836-42b9-afec-dcc4c456f73d.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.