-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds capability for sources to sink to channel and broker along with …
…ksvc
- Loading branch information
1 parent
31b6f67
commit ddf8889
Showing
14 changed files
with
236 additions
and
52 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
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
50 changes: 50 additions & 0 deletions
50
frontend/packages/knative-plugin/src/components/add/__tests__/EventSource.spec.tsx
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,50 @@ | ||
import * as React from 'react'; | ||
import { shallow, ShallowWrapper } from 'enzyme'; | ||
import { Formik } from 'formik'; | ||
import { EventSource } from '../EventSource'; | ||
|
||
type EventSourceProps = React.ComponentProps<typeof EventSource>; | ||
describe('EventSourceSpec', () => { | ||
let wrapper: ShallowWrapper<EventSourceProps>; | ||
const namespaceName = 'myApp'; | ||
const activeApplicationName = 'appGroup'; | ||
const eventSourceStatusData = null; | ||
|
||
it('should render form with proper initialvalues if contextSource is not passed', () => { | ||
wrapper = shallow( | ||
<EventSource | ||
namespace={namespaceName} | ||
eventSourceStatus={eventSourceStatusData} | ||
activeApplication={activeApplicationName} | ||
/>, | ||
); | ||
const FormikField = wrapper.find(Formik); | ||
expect(FormikField.exists()).toBe(true); | ||
expect(FormikField.get(0).props.initialValues.project.name).toBe('myApp'); | ||
expect(FormikField.get(0).props.initialValues.sink).toEqual({ | ||
apiVersion: '', | ||
kind: '', | ||
name: '', | ||
}); | ||
}); | ||
|
||
it('should render form with proper initialvalues for sink if contextSource is passed', () => { | ||
const contextSourceData = 'serving.knative.dev~v1~Service/svc-display'; | ||
wrapper = shallow( | ||
<EventSource | ||
namespace={namespaceName} | ||
eventSourceStatus={eventSourceStatusData} | ||
contextSource={contextSourceData} | ||
activeApplication={activeApplicationName} | ||
/>, | ||
); | ||
const FormikField = wrapper.find(Formik); | ||
expect(FormikField.exists()).toBe(true); | ||
expect(FormikField.get(0).props.initialValues.project.name).toBe('myApp'); | ||
expect(FormikField.get(0).props.initialValues.sink).toEqual({ | ||
apiVersion: 'serving.knative.dev/v1', | ||
kind: 'Service', | ||
name: 'svc-display', | ||
}); | ||
}); | ||
}); |
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
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
Oops, something went wrong.