1
1
import { ComponentMeta , Story } from "@storybook/react"
2
- import { ParameterSchema } from "../../api/typesGenerated"
3
- import { makeMockApiError , MockTemplate } from "../../testHelpers/entities"
2
+ import {
3
+ makeMockApiError ,
4
+ mockParameterSchema ,
5
+ MockTemplate ,
6
+ } from "../../testHelpers/entities"
4
7
import {
5
8
CreateWorkspaceErrors ,
6
9
CreateWorkspacePageView ,
7
10
CreateWorkspacePageViewProps ,
8
11
} from "./CreateWorkspacePageView"
9
12
10
- const createParameterSchema = (
11
- partial : Partial < ParameterSchema > ,
12
- ) : ParameterSchema => {
13
- return {
14
- id : "000000" ,
15
- job_id : "000000" ,
16
- allow_override_destination : false ,
17
- allow_override_source : true ,
18
- created_at : "" ,
19
- default_destination_scheme : "none" ,
20
- default_refresh : "" ,
21
- default_source_scheme : "data" ,
22
- default_source_value : "default-value" ,
23
- name : "parameter name" ,
24
- description : "Some description!" ,
25
- redisplay_value : false ,
26
- validation_condition : "" ,
27
- validation_contains : [ ] ,
28
- validation_error : "" ,
29
- validation_type_system : "" ,
30
- validation_value_type : "" ,
31
- ...partial ,
32
- }
33
- }
34
-
35
13
export default {
36
14
title : "pages/CreateWorkspacePageView" ,
37
15
component : CreateWorkspacePageView ,
@@ -54,7 +32,7 @@ Parameters.args = {
54
32
templates : [ MockTemplate ] ,
55
33
selectedTemplate : MockTemplate ,
56
34
templateSchema : [
57
- createParameterSchema ( {
35
+ mockParameterSchema ( {
58
36
name : "region" ,
59
37
default_source_value : "🏈 US Central" ,
60
38
description : "Where would you like your workspace to live?" ,
@@ -65,19 +43,19 @@ Parameters.args = {
65
43
"🦘 Australia South" ,
66
44
] ,
67
45
} ) ,
68
- createParameterSchema ( {
46
+ mockParameterSchema ( {
69
47
name : "instance_size" ,
70
48
default_source_value : "Big" ,
71
49
description : "How large should you instance be?" ,
72
50
validation_contains : [ "Small" , "Medium" , "Big" ] ,
73
51
} ) ,
74
- createParameterSchema ( {
52
+ mockParameterSchema ( {
75
53
name : "instance_size" ,
76
54
default_source_value : "Big" ,
77
55
description : "How large should your instance be?" ,
78
56
validation_contains : [ "Small" , "Medium" , "Big" ] ,
79
57
} ) ,
80
- createParameterSchema ( {
58
+ mockParameterSchema ( {
81
59
name : "disable_docker" ,
82
60
description : "Disable Docker?" ,
83
61
validation_value_type : "bool" ,
0 commit comments