Skip to content
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const identifierResultsResponse = {
price: {
value: 10,
originalValue: 10,
futureValue: 10,
hasDiscount: false,
},
rating: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ describe('platformAdapter tests', () => {
price: {
value: 10,
originalValue: 10,
futureValue: 10,
hasDiscount: false,
},
rating: {
Expand Down Expand Up @@ -578,7 +577,6 @@ describe('platformAdapter tests', () => {
price: {
hasDiscount: false,
originalValue: 10,
futureValue: 10,
value: 10,
},
rating: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ Object {
"modelName": "Result",
"name": "Locomotive Men Washed Blue Jeans",
"price": Object {
"futureValue": 10,
"hasDiscount": false,
"originalValue": 10,
"value": 10,
Expand Down Expand Up @@ -467,7 +466,6 @@ Object {
"modelName": "Result",
"name": "Locomotive Men Washed Blue Jeans",
"price": Object {
"futureValue": 10,
"hasDiscount": false,
"originalValue": 10,
"value": 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('recommendationsResponseMapper tests', () => {
price: {
hasDiscount: false,
originalValue: 10,
futureValue: 10,
value: 10,
},
rating: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const resultSchema = createMutableSchema<PlatformResult, Result>({
value: '__prices.current.value',
originalValue: ({ __prices: rawPrices }) =>
rawPrices.previous?.value ?? rawPrices.current.value,
futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,
/** @deprecated It is not a general purpose field. */
//futureValue: ({ __prices: rawPrices }) => rawPrices.future?.value ?? rawPrices.current.value,
hasDiscount: ({ __prices: rawPrices }) =>
rawPrices.current.value < (rawPrices.previous?.value ?? rawPrices.current.value),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export function createResultStub(name: string, result?: Partial<Result>): Result
price: {
hasDiscount: false,
originalValue: 10,
futureValue: 10,
value: 10,
},
rating: {
Expand Down
7 changes: 0 additions & 7 deletions packages/x-components/src/adapter/mocked-responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 59.99,
futureValue: 59.99,
value: 59.99,
},
}),
Expand All @@ -138,7 +137,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 29.99,
futureValue: 29.99,
value: 29.99,
},
}),
Expand All @@ -147,7 +145,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 11.99,
futureValue: 11.99,
value: 11.99,
},
}),
Expand All @@ -156,7 +153,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 39.99,
futureValue: 39.99,
value: 39.99,
},
}),
Expand All @@ -165,7 +161,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 11.99,
futureValue: 11.99,
value: 11.99,
},
}),
Expand All @@ -174,7 +169,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 11.99,
futureValue: 11.99,
value: 11.99,
},
}),
Expand All @@ -183,7 +177,6 @@ export const mockedResponses = {
price: {
hasDiscount: false,
originalValue: 22.99,
futureValue: 22.99,
value: 22.99,
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const mockedResult: Pick<Result, 'price'> = {
price: {
hasDiscount: true,
originalValue: 29.99,
futureValue: 29.99,
value: 19.99,
},
}
Expand Down Expand Up @@ -73,7 +72,6 @@ describe('testing BaseCurrentPrice component', () => {
price: {
hasDiscount: false,
originalValue: 29.99,
futureValue: 29.99,
value: 29.99,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const mockedResult: Pick<Result, 'price'> = {
price: {
hasDiscount: true,
originalValue: 29.99,
futureValue: 29.99,
value: 19.99,
},
}
Expand Down Expand Up @@ -70,7 +69,6 @@ describe('testing BaseResultPreviousPrice component', () => {
price: {
hasDiscount: false,
originalValue: 29.99,
futureValue: 29.99,
value: 29.99,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default defineComponent({
price: {
hasDiscount: false,
originalValue: 11.99,
futureValue: 11.99,
value: 11.99,
},
url: 'https://www.lolahome.es/escobilla-zen-ceramica-blanco-gris-29075',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ Given('a results API with broken images', () => {
hasDiscount: false,
originalValue: 59.99,
value: 59.99,
futureValue: 59.99,
},
}),
createResultStub('Result 2', {
Expand All @@ -272,7 +271,6 @@ Given('a results API with broken images', () => {
hasDiscount: false,
originalValue: 59.99,
value: 59.99,
futureValue: 59.99,
},
}),
createResultStub('Result 3', {
Expand All @@ -286,7 +284,6 @@ Given('a results API with broken images', () => {
hasDiscount: false,
originalValue: 59.99,
value: 59.99,
futureValue: 59.99,
},
}),
],
Expand Down
4 changes: 2 additions & 2 deletions packages/x-types/src/result/result-price.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface ResultPrice {
originalValue: number
/** The current value. */
value: number
/** Pre-warming price. */
futureValue: number
/** @deprecated It is not a general purpose field. */
futureValue?: number
/** Whether this result has discount. */
hasDiscount: boolean
}
4 changes: 2 additions & 2 deletions packages/x-types/src/schemas/result.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ResultSchema: Result = {
name: expect.any(String),
price: {
originalValue: expect.any(Number),
futureValue: expect.any(Number),
futureValue: expect.nullOrUndefinedOr(Number),
value: expect.any(Number),
hasDiscount: expect.any(Boolean),
},
Expand Down Expand Up @@ -50,7 +50,7 @@ export const RecommendationSchema: Result = {
name: expect.any(String),
price: {
originalValue: expect.any(Number),
futureValue: expect.any(Number),
futureValue: expect.nullOrUndefinedOr(Number),
value: expect.any(Number),
hasDiscount: expect.any(Boolean),
},
Expand Down