Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/build-profile.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { buildProfile } from '../dist/history/store.js';

const history = [
{ message: 'fix: bug' },
{ message: 'feat: feature' },
];

test('buildProfile returns correct profile', () => {
const profile = buildProfile(history);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Await the profile before asserting

This test currently asserts that the Promise returned by the async buildProfile function is truthy, so it passes without checking the resolved profile. It also passes an in-memory history array even though buildProfile reads history from disk by size, which means regressions in the profile calculation would not be caught by this test.

Useful? React with 👍 / 👎.

assert.ok(profile);
});