From c45b8c61de2d3a0d7ad9dd0771760df51bd92318 Mon Sep 17 00:00:00 2001 From: Cameron Otsuka Date: Sun, 12 Apr 2026 19:04:13 -0700 Subject: [PATCH] remove unnecessary tests and interface --- astro.config.mjs | 4 +- bun.lock | 4 +- .../index.mdx | 5 +- content/podcasts/mine-print-hash-2026-14.mdx | 2 +- content/podcasts/mine-print-hash-2026-15.mdx | 2 +- src/components/ui/figure.astro | 4 +- src/utils/__tests__/formatDate.test.ts | 24 ------- .../__tests__/generateStarRating.test.ts | 40 ------------ src/utils/__tests__/sortByDate.test.ts | 65 ------------------- src/utils/sortByDate.ts | 8 +-- 10 files changed, 13 insertions(+), 145 deletions(-) delete mode 100644 src/utils/__tests__/formatDate.test.ts delete mode 100644 src/utils/__tests__/generateStarRating.test.ts delete mode 100644 src/utils/__tests__/sortByDate.test.ts diff --git a/astro.config.mjs b/astro.config.mjs index a6e9125..5b8466c 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -72,8 +72,8 @@ export default defineConfig({ jpeg: { mozjpeg: true, progressive: true, quality: 75 }, webp: { quality: 75, effort: 4, alphaQuality: 80 }, avif: { quality: 50, effort: 2 }, - } - } + }, + }, }, vite: { build: { diff --git a/bun.lock b/bun.lock index 61a6ba1..3ca6907 100644 --- a/bun.lock +++ b/bun.lock @@ -9,11 +9,11 @@ "@astrojs/rss": "4.0.18", "@astrojs/sitemap": "3.7.2", "@iconify-json/mdi": "^1.2.3", - "@pagefind/component-ui": "^1.5.0", + "@pagefind/component-ui": "^1.5.2", "@vercel/og": "^0.8.6", "astro": "6.1.5", "astro-icon": "^1.1.5", - "pagefind": "^1.5.0", + "pagefind": "^1.5.2", }, "devDependencies": { "@astrojs/check": "0.9.8", diff --git a/content/articles/bitcoin-mempools-cleared-is-nobody-using-bitcoin/index.mdx b/content/articles/bitcoin-mempools-cleared-is-nobody-using-bitcoin/index.mdx index 8906c76..e71ef36 100644 --- a/content/articles/bitcoin-mempools-cleared-is-nobody-using-bitcoin/index.mdx +++ b/content/articles/bitcoin-mempools-cleared-is-nobody-using-bitcoin/index.mdx @@ -107,10 +107,7 @@ We haven't seen a significant decline in total hashrate, despite hashprice decre Index](https://data.hashrateindex.com/network-data/bitcoin-hashprice-index). -
+
Bitcoin hashrate over the last 2 years. Data from 2023-02-08 through 2025-02-07. Source: [mempool.space](https://mempool.space/graphs/mining/hashrate-difficulty#2y). diff --git a/content/podcasts/mine-print-hash-2026-14.mdx b/content/podcasts/mine-print-hash-2026-14.mdx index 65d9666..4903c75 100644 --- a/content/podcasts/mine-print-hash-2026-14.mdx +++ b/content/podcasts/mine-print-hash-2026-14.mdx @@ -1,6 +1,6 @@ --- type: video -title: "The Return of Productive American Growth: Artemis, Oil Flippening, and Credit Expansion" +title: 'The Return of Productive American Growth: Artemis, Oil Flippening, and Credit Expansion' date: 2026-04-02 modified: 2026-04-02 description: 'Mine, Print, Hash - 2026 Week #14' diff --git a/content/podcasts/mine-print-hash-2026-15.mdx b/content/podcasts/mine-print-hash-2026-15.mdx index cb1c7ed..cd1a878 100644 --- a/content/podcasts/mine-print-hash-2026-15.mdx +++ b/content/podcasts/mine-print-hash-2026-15.mdx @@ -1,6 +1,6 @@ --- type: video -title: "Ceasefire and Contagion: Factions Against Iran Peace & FX, Sovereign Debt, and Commodity Spillovers" +title: 'Ceasefire and Contagion: Factions Against Iran Peace & FX, Sovereign Debt, and Commodity Spillovers' date: 2026-04-09 modified: 2026-04-09 description: 'Mine, Print, Hash - 2026 Week #15' diff --git a/src/components/ui/figure.astro b/src/components/ui/figure.astro index 0ed2c07..e90794e 100644 --- a/src/components/ui/figure.astro +++ b/src/components/ui/figure.astro @@ -1,12 +1,12 @@ --- import { Picture } from 'astro:assets'; -import type { ImageLayout, ImageMetadata } from 'astro'; +import type { ImageMetadata } from 'astro'; interface Props { image: ImageMetadata; alt: string; formats?: string[]; - layout?: ImageLayout; + layout?: 'constrained' | 'full-width' | 'fixed' | 'none'; } const { image, alt, formats = ['avif', 'webp'], layout } = Astro.props; diff --git a/src/utils/__tests__/formatDate.test.ts b/src/utils/__tests__/formatDate.test.ts deleted file mode 100644 index 0473915..0000000 --- a/src/utils/__tests__/formatDate.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, it, expect } from 'bun:test'; -import formatDate from '../formatDate'; - -describe('formatDate', () => { - it('formats date as YYYY-MM-DD', () => { - const date = new Date(Date.UTC(2024, 2, 15)); // March 15, 2024 - expect(formatDate(date)).toBe('2024-03-15'); - }); - - it('pads single-digit months with zero', () => { - const date = new Date(Date.UTC(2024, 0, 1)); // January 1, 2024 - expect(formatDate(date)).toBe('2024-01-01'); - }); - - it('pads single-digit days with zero', () => { - const date = new Date(Date.UTC(2024, 11, 5)); // December 5, 2024 - expect(formatDate(date)).toBe('2024-12-05'); - }); - - it('handles year boundaries correctly', () => { - const date = new Date(Date.UTC(2023, 11, 31)); // December 31, 2023 - expect(formatDate(date)).toBe('2023-12-31'); - }); -}); diff --git a/src/utils/__tests__/generateStarRating.test.ts b/src/utils/__tests__/generateStarRating.test.ts deleted file mode 100644 index f2df478..0000000 --- a/src/utils/__tests__/generateStarRating.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { describe, it, expect } from 'bun:test'; -import generateStarRating from '../generateStarRating'; - -describe('generateStarRating', () => { - it('returns 5 filled stars for rating 5', () => { - expect(generateStarRating(5)).toBe('★★★★★'); - }); - - it('returns 1 filled and 4 empty stars for rating 1', () => { - expect(generateStarRating(1)).toBe('★☆☆☆☆'); - }); - - it('returns 3 filled and 2 empty stars for rating 3', () => { - expect(generateStarRating(3)).toBe('★★★☆☆'); - }); - - it('throws for rating 0', () => { - expect(() => generateStarRating(0)).toThrow( - 'Invalid rating: 0. Must be an integer between 1 and 5.', - ); - }); - - it('throws for rating 6', () => { - expect(() => generateStarRating(6)).toThrow( - 'Invalid rating: 6. Must be an integer between 1 and 5.', - ); - }); - - it('throws for non-integer rating', () => { - expect(() => generateStarRating(3.5)).toThrow( - 'Invalid rating: 3.5. Must be an integer between 1 and 5.', - ); - }); - - it('throws for negative rating', () => { - expect(() => generateStarRating(-1)).toThrow( - 'Invalid rating: -1. Must be an integer between 1 and 5.', - ); - }); -}); diff --git a/src/utils/__tests__/sortByDate.test.ts b/src/utils/__tests__/sortByDate.test.ts deleted file mode 100644 index 146af37..0000000 --- a/src/utils/__tests__/sortByDate.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { describe, it, expect } from 'bun:test'; -import sortByDate from '../sortByDate'; - -// Mock type for testing - matches the HasDate interface expected by sortByDate -interface MockEntry { - data: { date: Date }; -} - -describe('sortByDate', () => { - it('sorts items by date in descending order (newest first)', () => { - const items: MockEntry[] = [ - { data: { date: new Date('2024-01-15') } }, - { data: { date: new Date('2024-03-20') } }, - { data: { date: new Date('2024-02-10') } }, - ]; - - const sorted = sortByDate(items); - - expect(sorted[0].data.date.getTime()).toBe( - new Date('2024-03-20').getTime(), - ); - expect(sorted[1].data.date.getTime()).toBe( - new Date('2024-02-10').getTime(), - ); - expect(sorted[2].data.date.getTime()).toBe( - new Date('2024-01-15').getTime(), - ); - }); - - it('handles items with same date', () => { - const items: MockEntry[] = [ - { data: { date: new Date('2024-01-15') } }, - { data: { date: new Date('2024-01-15') } }, - ]; - - const sorted = sortByDate(items); - - expect(sorted).toHaveLength(2); - }); - - it('returns empty array for empty input', () => { - const sorted = sortByDate([]); - expect(sorted).toEqual([]); - }); - - it('handles single item array', () => { - const items: MockEntry[] = [{ data: { date: new Date('2024-01-15') } }]; - - const sorted = sortByDate(items); - - expect(sorted).toHaveLength(1); - }); - - it('does not mutate original array', () => { - const items: MockEntry[] = [ - { data: { date: new Date('2024-01-01') } }, - { data: { date: new Date('2024-03-01') } }, - ]; - const originalFirst = items[0]; - - sortByDate(items); - - expect(items[0]).toBe(originalFirst); - }); -}); diff --git a/src/utils/sortByDate.ts b/src/utils/sortByDate.ts index 2dd18dd..7eb91e6 100644 --- a/src/utils/sortByDate.ts +++ b/src/utils/sortByDate.ts @@ -1,8 +1,8 @@ -interface HasDate { - data: { date: Date }; -} +import { type SiteCollectionEntry } from '@utils/globals'; -export default function sortByDate(items: T[]): T[] { +export default function sortByDate( + items: T[], +): T[] { return [...items].sort( (a, b) => b.data.date.getTime() - a.data.date.getTime(), ); -- 2.53.0