Update tests
This commit is contained in:
parent
36396c9d3e
commit
3bb73bbbe5
4 changed files with 23 additions and 418 deletions
|
@ -28,39 +28,7 @@ Object {
|
|||
"price": Object {
|
||||
"all": true,
|
||||
"attribute": undefined,
|
||||
"value": "",
|
||||
"values": Array [],
|
||||
},
|
||||
"stock": Object {
|
||||
"all": true,
|
||||
"attribute": undefined,
|
||||
"value": "",
|
||||
"values": Array [],
|
||||
},
|
||||
"variants": Array [],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Reducer is able to select attributes 1`] = `
|
||||
Object {
|
||||
"attributes": Array [
|
||||
Object {
|
||||
"id": "attr-1",
|
||||
"values": Array [],
|
||||
},
|
||||
Object {
|
||||
"id": "attr-2",
|
||||
"values": Array [],
|
||||
},
|
||||
Object {
|
||||
"id": "attr-4",
|
||||
"values": Array [],
|
||||
},
|
||||
],
|
||||
"price": Object {
|
||||
"all": true,
|
||||
"attribute": undefined,
|
||||
"value": "",
|
||||
"value": "10.99",
|
||||
"values": Array [],
|
||||
},
|
||||
"stock": Object {
|
||||
|
@ -343,7 +311,7 @@ Object {
|
|||
"price": Object {
|
||||
"all": false,
|
||||
"attribute": "attr-1",
|
||||
"value": "",
|
||||
"value": "10.99",
|
||||
"values": Array [
|
||||
Object {
|
||||
"slug": "val-1-1",
|
||||
|
@ -594,7 +562,7 @@ Object {
|
|||
"price": Object {
|
||||
"all": true,
|
||||
"attribute": undefined,
|
||||
"value": "",
|
||||
"value": "10.99",
|
||||
"values": Array [],
|
||||
},
|
||||
"stock": Object {
|
||||
|
@ -625,7 +593,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -650,7 +618,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -675,7 +643,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -700,7 +668,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -725,7 +693,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -750,7 +718,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -775,7 +743,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -800,7 +768,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 45,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -836,7 +804,7 @@ Object {
|
|||
"price": Object {
|
||||
"all": true,
|
||||
"attribute": undefined,
|
||||
"value": "",
|
||||
"value": "10.99",
|
||||
"values": Array [],
|
||||
},
|
||||
"stock": Object {
|
||||
|
@ -876,7 +844,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 13,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -901,7 +869,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 13,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -926,7 +894,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 13,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -951,7 +919,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 13,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -976,7 +944,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 19,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -1001,7 +969,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 19,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -1026,7 +994,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 19,
|
||||
"sku": "",
|
||||
},
|
||||
|
@ -1051,7 +1019,7 @@ Object {
|
|||
],
|
||||
},
|
||||
],
|
||||
"priceOverride": "",
|
||||
"priceOverride": "10.99",
|
||||
"quantity": 19,
|
||||
"sku": "",
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { createVariants } from "./createVariants";
|
||||
import {
|
||||
AllOrAttribute,
|
||||
initialForm,
|
||||
createInitialForm,
|
||||
ProductVariantCreateFormData
|
||||
} from "./form";
|
||||
|
||||
|
@ -33,7 +33,7 @@ export const attributes = [
|
|||
];
|
||||
|
||||
export const secondStep: ProductVariantCreateFormData = {
|
||||
...initialForm,
|
||||
...createInitialForm([], "10.99"),
|
||||
attributes: [
|
||||
{
|
||||
id: attributes[0].id,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { attributes, fourthStep, secondStep, thirdStep } from "./fixtures";
|
||||
import { initialForm } from "./form";
|
||||
import reducer, { VariantField } from "./reducer";
|
||||
|
||||
function execActions<TState, TAction>(
|
||||
|
@ -11,26 +10,6 @@ function execActions<TState, TAction>(
|
|||
}
|
||||
|
||||
describe("Reducer is able to", () => {
|
||||
it("select attributes", () => {
|
||||
const state = execActions(initialForm, reducer, [
|
||||
{
|
||||
attributeId: attributes[0].id,
|
||||
type: "selectAttribute"
|
||||
},
|
||||
{
|
||||
attributeId: attributes[1].id,
|
||||
type: "selectAttribute"
|
||||
},
|
||||
{
|
||||
attributeId: attributes[3].id,
|
||||
type: "selectAttribute"
|
||||
}
|
||||
]);
|
||||
|
||||
expect(state.attributes).toHaveLength(3);
|
||||
expect(state).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("select attribute values", () => {
|
||||
const state = execActions(secondStep, reducer, [
|
||||
{
|
||||
|
|
|
@ -82066,15 +82066,6 @@ exports[`Storyshots Views / Products / Create multiple variants / summary defaul
|
|||
<div
|
||||
class="ProductVariantCreateTabs-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiTypography-caption-id ProductVariantCreateTabs-label-id"
|
||||
>
|
||||
Choose Attributes
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
|
@ -82778,15 +82769,6 @@ exports[`Storyshots Views / Products / Create multiple variants / summary errors
|
|||
<div
|
||||
class="ProductVariantCreateTabs-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiTypography-caption-id ProductVariantCreateTabs-label-id"
|
||||
>
|
||||
Choose Attributes
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
|
@ -83495,15 +83477,6 @@ exports[`Storyshots Views / Products / Create multiple variants choose attribute
|
|||
<div
|
||||
class="ProductVariantCreateTabs-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabActive-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiTypography-caption-id ProductVariantCreateTabs-label-id"
|
||||
>
|
||||
Choose Attributes
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id"
|
||||
>
|
||||
|
@ -83534,304 +83507,7 @@ exports[`Storyshots Views / Products / Create multiple variants choose attribute
|
|||
</div>
|
||||
<div
|
||||
class="Hook-root-id"
|
||||
>
|
||||
<table
|
||||
class="MuiTable-root-id"
|
||||
>
|
||||
<tbody
|
||||
class="MuiTableBody-root-id"
|
||||
>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Author
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id Checkbox-checked-id"
|
||||
type="checkbox"
|
||||
value="true"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Box Size
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Brand
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Candy Box Size
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id Checkbox-checked-id"
|
||||
type="checkbox"
|
||||
value="true"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Coffee Genre
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id Checkbox-checked-id"
|
||||
type="checkbox"
|
||||
value="true"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Collar
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Color
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Cover
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Flavor
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Language
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Publisher
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="MuiTableRow-root-id"
|
||||
>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id MuiTableCell-paddingCheckbox-id Hook-checkboxCell-id"
|
||||
>
|
||||
<button
|
||||
class="MuiButtonBase-root-id Checkbox-root-id"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<input
|
||||
class="Checkbox-box-id"
|
||||
type="checkbox"
|
||||
value="false"
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id Hook-wideCell-id"
|
||||
>
|
||||
Size
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -83859,15 +83535,6 @@ exports[`Storyshots Views / Products / Create multiple variants prices and SKU 1
|
|||
<div
|
||||
class="ProductVariantCreateTabs-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiTypography-caption-id ProductVariantCreateTabs-label-id"
|
||||
>
|
||||
Choose Attributes
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
|
@ -84418,15 +84085,6 @@ exports[`Storyshots Views / Products / Create multiple variants select values 1`
|
|||
<div
|
||||
class="ProductVariantCreateTabs-root-id"
|
||||
>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
<span
|
||||
class="MuiTypography-root-id MuiTypography-caption-id ProductVariantCreateTabs-label-id"
|
||||
>
|
||||
Choose Attributes
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ProductVariantCreateTabs-tab-id ProductVariantCreateTabs-tabActive-id ProductVariantCreateTabs-tabUnderline-id"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue