1
1
// Copyright 2021-2022 the Kubeapps contributors.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- import MonacoEditor from "react-monaco-editor" ;
5
4
import { SupportedThemes } from "shared/Config" ;
6
5
import { defaultStore , getStore , mountWrapper } from "shared/specs/mountWrapper" ;
7
6
import { IStoreState } from "shared/types" ;
@@ -24,7 +23,7 @@ beforeEach(() => {
24
23
} ) ) ,
25
24
} ) ;
26
25
27
- // mock the window.ResizeObserver, required by the MonacoEditor for the layout
26
+ // mock the window.ResizeObserver, required by the MonacoDiffEditor for the layout
28
27
Object . defineProperty ( window , "ResizeObserver" , {
29
28
writable : true ,
30
29
configurable : true ,
@@ -35,7 +34,7 @@ beforeEach(() => {
35
34
} ) ) ,
36
35
} ) ;
37
36
38
- // mock the window.HTMLCanvasElement.getContext(), required by the MonacoEditor for the layout
37
+ // mock the window.HTMLCanvasElement.getContext(), required by the MonacoDiffEditor for the layout
39
38
Object . defineProperty ( HTMLCanvasElement . prototype , "getContext" , {
40
39
writable : true ,
41
40
configurable : true ,
@@ -51,25 +50,30 @@ afterEach(() => {
51
50
52
51
const defaultProps = {
53
52
handleValuesChange : jest . fn ( ) ,
53
+ valuesFromTheDeployedPackage : "" ,
54
+ valuesFromTheAvailablePackage : "" ,
55
+ deploymentEvent : "" ,
56
+ valuesFromTheParentContainer : "" ,
54
57
} ;
55
58
59
+ // eslint-disable-next-line jest/no-focused-tests
56
60
it ( "includes values" , ( ) => {
57
61
const wrapper = mountWrapper (
58
62
defaultStore ,
59
- < AdvancedDeploymentForm { ...defaultProps } appValues = "foo: bar" /> ,
63
+ < AdvancedDeploymentForm { ...defaultProps } valuesFromTheParentContainer = "foo: bar" /> ,
60
64
) ;
61
- expect ( wrapper . find ( MonacoEditor ) . prop ( "value" ) ) . toBe ( "foo: bar" ) ;
65
+ expect ( wrapper . find ( "MonacoDiffEditor" ) . prop ( "value" ) ) . toBe ( "foo: bar" ) ;
62
66
} ) ;
63
67
64
68
it ( "sets light theme by default" , ( ) => {
65
69
const wrapper = mountWrapper ( defaultStore , < AdvancedDeploymentForm { ...defaultProps } /> ) ;
66
- expect ( wrapper . find ( MonacoEditor ) . prop ( "theme" ) ) . toBe ( "light" ) ;
70
+ expect ( wrapper . find ( "MonacoDiffEditor" ) . prop ( "theme" ) ) . toBe ( "light" ) ;
67
71
} ) ;
68
72
69
73
it ( "changes theme" , ( ) => {
70
74
const wrapper = mountWrapper (
71
75
getStore ( { config : { theme : SupportedThemes . dark } } as Partial < IStoreState > ) ,
72
76
< AdvancedDeploymentForm { ...defaultProps } /> ,
73
77
) ;
74
- expect ( wrapper . find ( MonacoEditor ) . prop ( "theme" ) ) . toBe ( "vs-dark" ) ;
78
+ expect ( wrapper . find ( "MonacoDiffEditor" ) . prop ( "theme" ) ) . toBe ( "vs-dark" ) ;
75
79
} ) ;
0 commit comments