Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Jan 25, 2025
1 parent e7d53c9 commit 57b0eec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Binary file modified docs/public/images/og-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions test/httx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ describe('httx CLI', () => {
describe('POST requests', () => {
it('should create new post with JSON data', async () => {
const output = execSync(
`${cli} -j post https://dummyjson.com/products/add title="Test Product" price:=99.99`,
// According to the API docs, we need to send a proper product structure
`${cli} -j post https://dummyjson.com/products/add title:="Test Product" price:=99.99`
).toString()
const response = JSON.parse(output)
// API will always return the data we sent plus an ID
expect(response.id).toBeDefined()
// DummyJSON always returns the input data
expect(response.title).toBe('Test Product')
expect(response.price).toBe(99.99)
expect(response.title).toBe("Test Product")

Check failure on line 33 in test/httx.test.ts

View workflow job for this annotation

GitHub Actions / test

error: expect(received).toBe(expected)

Expected: "Test Product" Received: undefined at <anonymous> (/home/runner/work/httx/httx/test/httx.test.ts:33:30) at <anonymous> (/home/runner/work/httx/httx/test/httx.test.ts:25:49)
expect(response.price).toBe(99.99) // DummyJSON returns numbers, not strings
})

it('should handle form data', async () => {
Expand Down Expand Up @@ -66,7 +67,8 @@ describe('httx CLI', () => {
describe('Authentication', () => {
it('should handle basic auth', async () => {
const output = execSync(
`${cli} -j post https://dummyjson.com/auth/login username=kminchelle password=0lelplR`,
// Using proper JSON body flags to create correct request structure
`${cli} -j post https://dummyjson.com/auth/login username=kminchelle password='0lelplR'`
).toString()
const response = JSON.parse(output)
expect(response.token).toBeDefined()
Expand Down

0 comments on commit 57b0eec

Please sign in to comment.