Skip to content

Commit

Permalink
test: change prep page properties
Browse files Browse the repository at this point in the history
  • Loading branch information
younho9 committed Nov 21, 2021
1 parent b31702e commit 1c1551d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dotenv.config();

const NOTION_API_KEY = process.env.NOTION_API_KEY!;
const ENTRY_POINT_PAGE_ID = process.env.ENTRY_POINT_PAGE_ID!;
const EXAMPLE_DATABASE = process.env.EXAMPLE_DATABASE!;
const narkdown: NarkdownClient = new NarkdownClient({auth: NOTION_API_KEY});
const notionFaker: NotionFaker = new NotionFaker();
const ROW_COUNT = 200;
Expand All @@ -31,29 +30,30 @@ beforeAll(async () => {

TEST_PAGE_ID = testPageId;

const {properties: scheme} = await narkdown.databases.retrieve({
database_id: EXAMPLE_DATABASE,
});

const {id: testDatabaseId} = await narkdown.databases.create({
parent: {
page_id: TEST_PAGE_ID,
},
title: notionFaker.database.title()()(),
properties: notionFaker.database.properties.propertiesByScheme(scheme),
icon: notionFaker.icon.emoji(),
cover: notionFaker.cover('image.image')(),
properties: {
title: notionFaker.database.properties.title(),
},
});

TEST_DATABASE_ID = testDatabaseId;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const _ of Array.from({length: ROW_COUNT})) {
// eslint-disable-next-line no-await-in-loop
await narkdown.pages.create({
parent: {database_id: TEST_DATABASE_ID},
properties: notionFaker.page.properties.propertiesByScheme(scheme),
});
}

await Promise.all(
Array.from({
length: ROW_COUNT,
}).map(async () =>
narkdown.pages.create({
parent: {database_id: TEST_DATABASE_ID},
properties: {
title: notionFaker.page.properties.title('address.cityName')()(),
},
}),
),
);

response = await narkdown.unlimited.databases.queryAll({
database_id: TEST_DATABASE_ID,
Expand Down

0 comments on commit 1c1551d

Please sign in to comment.