Skip to content

Commit

Permalink
Remove docs
Browse files Browse the repository at this point in the history
  • Loading branch information
argaen committed Apr 4, 2024
1 parent c047f4e commit 59ad96a
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 422 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ If you want to see the magic of server rendering, check it with `yarn build`. It
Route (app) Size First Load JS
┌ ○ / 180 B 91.3 kB
├ ○ /_not-found 885 B 85.2 kB
├ ○ /docs 195 B 91.3 kB
├ ● /docs/[slug] 195 B 91.3 kB
├ ├ /docs/commodities
├ ├ /docs/transactions
├ ├ /docs/overview
├ └ /docs/accounts
├ ● /posts/[slug] 195 B 91.3 kB
├ ├ /posts/gapi-authentication-nextjs
├ ├ /posts/static-server-rendering-nextjs
Expand Down
34 changes: 0 additions & 34 deletions src/__tests__/app/api/getPosts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DateTime } from 'luxon';

import {
getPosts,
getDocs,
getPostsByTag,
getPost,
} from '@/app/api/getPosts';
Expand Down Expand Up @@ -145,30 +144,6 @@ describe('getPosts', () => {
expect(posts).toEqual([]);
});

it('ignores #docs', async () => {
mockListForRepo.mockResolvedValue({
data: [
{
title: '[draft] My Blog Post: Part 1',
body: '#header',
labels: [
{
name: 'docs',
},
],
created_at: '2023-01-01T00:00:00',
user: {
login: 'username',
avatar_url: 'avatar_url',
},
},
],
});

const posts = await getPosts();
expect(posts).toEqual([]);
});

it('returns empty list when no posts available', async () => {
mockListForRepo.mockResolvedValue({ data: [] });

Expand All @@ -177,15 +152,6 @@ describe('getPosts', () => {
});
});

describe('getDocs', () => {
it('retrieves posts with #docs label only', async () => {
await getDocs();
expect(mockListForRepo).toBeCalledWith(expect.objectContaining({
labels: 'docs',
}));
});
});

describe('getPost', () => {
beforeEach(() => {
mockListForRepo.mockResolvedValue({
Expand Down
133 changes: 0 additions & 133 deletions src/__tests__/app/docs/[slug]/page.test.tsx

This file was deleted.

57 changes: 0 additions & 57 deletions src/__tests__/app/docs/page.test.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/__tests__/components/PostDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,4 @@ describe('PostDetailTest', () => {

expect(container).toMatchSnapshot();
});

it('renders doc as expected', async () => {
const post = {
content: '<div>Content</div>',
slug: 'my-doc',
summary: 'Doc summary TODO',
tags: ['docs'],
reading_time: '1 min',
title: 'My Doc',
date: DateTime.fromISO('2023-01-01'),
author: {
name: 'Name',
avatar: 'https://avatar.image',
},
} as Post;
const { container } = render(<PostDetail post={post} />);

expect(container).toMatchSnapshot();
});
});
5 changes: 0 additions & 5 deletions src/__tests__/components/TagsWidget.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ describe('TagsWidget', () => {
expect(Tag).toBeCalledTimes(0);
});

it('is empty when "docs" in the tags', () => {
render(<TagsWidget tags={['a', 'b', 'docs']} />);
expect(Tag).toBeCalledTimes(0);
});

it('renders as expected when valid tags', () => {
const { container } = render(<TagsWidget tags={['a', 'b']} />);
expect(Tag).toBeCalledTimes(2);
Expand Down
61 changes: 0 additions & 61 deletions src/__tests__/components/__snapshots__/PostDetail.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,66 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PostDetailTest renders doc as expected 1`] = `
<div>
<article>
<div
class="xl:divide-y xl:divide-gray-200 xl:dark:divide-gray-700"
>
<header
class="text-center pt-6 xl:pb-6"
>
<h1
class="heading"
>
My Doc
</h1>
</header>
<div
class="pb-8 xl:grid xl:grid-cols-4 xl:gap-x-6"
style="grid-template-rows: auto 1fr;"
>
<div
class="sidenav"
>
<div
class="nav-section"
>
<h2
class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400"
>
Table of contents
</h2>
<div
data-testid="TableOfContents"
/>
</div>
<div
class="nav-section"
>
<div
data-testid="TagsWidget"
/>
</div>
</div>
<div
class="xl:col-span-3 xl:row-span-2 xl:pb-0"
>
<div
class="prose prose-img:mx-auto max-w-none pt-10 pb-8 dark:prose-dark"
>
<div>
<div>
Content
</div>
</div>
</div>
</div>
</div>
</div>
</article>
</div>
`;

exports[`PostDetailTest renders post as expected 1`] = `
<div>
<article>
Expand Down
7 changes: 1 addition & 6 deletions src/app/api/getPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type Post = {

export async function getPosts(): Promise<Post[]> {
const posts = await get();
return posts.filter(p => !p.tags.includes('docs'));
return posts;
}

export async function getPost(slug: string): Promise<null | Post> {
Expand All @@ -32,11 +32,6 @@ export async function getPostsByTag(tag: string): Promise<Post[]> {
return posts;
}

export async function getDocs(): Promise<Post[]> {
const posts = await get('docs');
return posts;
}

async function get(labels?: string): Promise<Post[]> {
const octokit = new Octokit();
const issues = (await octokit.rest.issues.listForRepo({
Expand Down
Loading

0 comments on commit 59ad96a

Please sign in to comment.