Repository: medusajs/medusa
File: integration-tests/http/__tests__/order/admin/order.spec.ts (TypeScript)

Code before:
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders).toEqual([
          expect.objectContaining({
            id: order.id,
          }),
        ])

        response = await api.get(
          `/admin/orders?q=${order.billing_address.address_2}`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders).toEqual([
          expect.objectContaining({
            id: order.id,
          }),
        ])
      })

      it("should return shipping_address when pagination included", async () => {
        const response = await api.get(
          `/admin/orders?fields=+shipping_address.*&offset=0`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders[0].id).toEqual(order.id)
        expect(response.data.orders[0].shipping_address).toBeDefined()
        expect(response.data.orders[0].shipping_address.address_1).toEqual(
          order.shipping_address.address_1
        )
        expect(response.data.orders[0].shipping_address.city).toEqual(
          order.shipping_address.city
        )
      })

      it("should return billing_address when pagination included", async () => {
        const response = await api.get(
          `/admin/orders?fields=+billing_address.*&offset=0`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders[0].id).toEqual(order.id)
        expect(response.data.orders[0].billing_address).toBeDefined()
        expect(response.data.orders[0].billing_address.address_1).toEqual(
          order.billing_address.address_1

Review comment (suggestion):
The api call should do that instead
```suggestion
          `/admin/orders?fields=*shipping_address&offset=0`,
```

Code after:
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders).toEqual([
          expect.objectContaining({
            id: order.id,
          }),
        ])

        response = await api.get(
          `/admin/orders?q=${order.billing_address.address_2}`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders).toEqual([
          expect.objectContaining({
            id: order.id,
          }),
        ])
      })

      it("should return shipping_address when pagination included", async () => {
        const response = await api.get(
          `/admin/orders?fields=*shipping_address&offset=0`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders[0].id).toEqual(order.id)
        expect(response.data.orders[0].shipping_address).toBeDefined()
        expect(response.data.orders[0].shipping_address.address_1).toEqual(
          order.shipping_address.address_1
        )
        expect(response.data.orders[0].shipping_address.city).toEqual(
          order.shipping_address.city
        )
      })

      it("should return billing_address when pagination included", async () => {        
        const response = await api.get(
          `/admin/orders?fields=*billing_address&offset=0`,
          adminHeaders
        )

        expect(response.data.orders).toHaveLength(1)
        expect(response.data.orders[0].id).toEqual(order.id)
        expect(response.data.orders[0].billing_address).toBeDefined()
        expect(response.data.orders[0].billing_address.address_1).toEqual(
          order.billing_address.address_1