Skip to content

Conversation

@devdumpling
Copy link
Contributor

Overview

Wanted to get a better understanding of the repo so started trying to add some tests. Looks like these server utils were a bit underserved and relatively pure / understandable. Let me know if you have any questions / thoughts.

@vercel
Copy link

vercel bot commented Jan 24, 2026

@devdumpling is attempting to deploy a commit to the danielroe Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops ignore this change, will pull it out--meant to only keep it in this PR: #26

will pull it shortly

Comment on lines +7 to +24
const mockFetchOk = <T>(body: T) => {
const fetchMock = vi.fn().mockResolvedValue({
ok: true,
json: async () => body,
})
vi.stubGlobal('fetch', fetchMock)
return fetchMock
}

const mockFetchError = (status: number) => {
const fetchMock = vi.fn().mockResolvedValue({
ok: false,
status,
})
vi.stubGlobal('fetch', fetchMock)
return fetchMock
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could move these out for re-use but haven't looked at all the testing patterns in place yet in full


describe('convertToFileTree', () => {
it('converts jsDelivr nodes to a sorted tree with directories first', () => {
const input: JsDelivrFileNode[] = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not super familiar with jsDeliver. LMK if this is too rudimentary.

@danielroe danielroe merged commit c979fbf into npmx-dev:main Jan 24, 2026
7 of 8 checks passed
@danielroe
Copy link
Member

this is great - thank you! ❤️

vinnymac pushed a commit to vinnymac/npmx.dev that referenced this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants