-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix customer is not present on the order list page (#3823)
- Loading branch information
Showing
4 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
Fix customer is not present in order list view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { OrderListQuery } from "@dashboard/graphql"; | ||
import { RelayToFlat } from "@dashboard/types"; | ||
|
||
import { getCustomerCellContent } from "./datagrid"; | ||
|
||
describe("getCustomerCellContent", () => { | ||
it("should return billing address first name and last name when exists", () => { | ||
// Arrange | ||
const data = { | ||
billingAddress: { | ||
firstName: "John", | ||
lastName: "Doe", | ||
}, | ||
} as RelayToFlat<NonNullable<OrderListQuery["orders"]>>[number]; | ||
|
||
// Act | ||
const result = getCustomerCellContent(data); | ||
|
||
// Assert | ||
expect(result.data).toEqual("John Doe"); | ||
expect(result.displayData).toEqual("John Doe"); | ||
}); | ||
|
||
it("should return user email when exists", () => { | ||
// Arrange | ||
const data = { | ||
billingAddress: { | ||
city: "New York", | ||
}, | ||
userEmail: "john@doe.com", | ||
} as RelayToFlat<NonNullable<OrderListQuery["orders"]>>[number]; | ||
|
||
// Act | ||
const result = getCustomerCellContent(data); | ||
|
||
// Assert | ||
expect(result.data).toEqual("john@doe.com"); | ||
expect(result.displayData).toEqual("john@doe.com"); | ||
}); | ||
|
||
it("should return - when no user email and billing address", () => { | ||
// Arrange | ||
const data = {} as RelayToFlat< | ||
NonNullable<OrderListQuery["orders"]> | ||
>[number]; | ||
|
||
// Act | ||
const result = getCustomerCellContent(data); | ||
|
||
// Assert | ||
expect(result.data).toEqual("-"); | ||
expect(result.displayData).toEqual("-"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters