This file contains hidden or 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
pipeline { | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '50')) | |
timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
} | |
agent { | |
kubernetes { | |
label "zaproxy-maven-sidecars-${env.BUILD_ID}" | |
defaultContainer 'jenkins-slave-mvn' | |
yaml """ |
This file contains hidden or 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
// Pull the configmap from the K8 API using the Jenkins service account and store it in the podTemplateYaml variable | |
def podTemplateYaml = '' | |
openshift.withCluster() { | |
openshift.withProject() { | |
cmsel = opeshift.selector("configmap", [role: 'jenkins-slave' ]) | |
cmsel.watch { | |
podTemplateYaml = it.object().data[bw-maven] | |
} | |
} | |
} |
This file contains hidden or 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
import groovy.json.JsonSlurper | |
pipeline { | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '50')) | |
timeout(time: 20, unit: 'MINUTES') // If the build takes longer than 20 minutes, fail automatically | |
} | |
agent { | |
kubernetes { | |
label "zaproxy-maven-sidecars-${env.BUILD_ID}" |
This file contains hidden or 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
// Mount a Vue component into the Virtual DOM, and pass any mocked objects which are appropriate | |
wrapper = mount(MyComponent, { | |
localVue, | |
mocks: { // Implement the mocks here! | |
$axios, | |
$router | |
} | |
}); | |
// Make an assertion against the component's '$data' object |
This file contains hidden or 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
expect(axios.put).toHaveBeenCalledTimes(1); | |
// Check to see if the parameters are correct | |
expect(axios.put).toHaveBeenCalledWith('/api/v1/user', { username: USERNAME, password: PASSWORD }); | |
// Check to ensure that the method reached a "return" statement | |
expect(axios.put).toHaveReturned(); |
This file contains hidden or 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
axios.get = jest.fn((path, options) => { | |
expect(path).toEqual('/api/v1/user'); | |
expect(options.username).toEqual(USERNAME); | |
expect(options.password).toEqual(PASSWORD); | |
let response = { | |
// 'data' is the response that was provided by the server | |
data: TOKEN, | |
// 'status' is the HTTP status code from the server response | |
status: 200, | |
// 'statusText' is the HTTP status message from the server response |
This file contains hidden or 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
import { shallowMount } from '@vue/test-utils' | |
import MessageToggle from '@/components/MessageToggle.vue' | |
import Message from '@/components/Message' | |
// Define the test method to be prefixed with `async` | |
describe('MessageToggle.vue', async () => { | |
it('toggles msg passed to Message when button is clicked', () => { | |
const wrapper = shallowMount(MessageToggle) | |
const button = wrapper.find('#toggle-message') | |
button.trigger('click') |
This file contains hidden or 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
import { shallowMount } from '@vue/test-utils' | |
import MessageToggle from '@/components/MessageToggle.vue' | |
import Message from '@/components/Message' | |
describe('MessageToggle.vue', () => { | |
it('toggles msg passed to Message when button is clicked', () => { | |
const wrapper = shallowMount(MessageToggle) | |
const button = wrapper.find('#toggle-message') | |
button.trigger('click') | |
const MessageComponent = wrapper.find(Message) |
This file contains hidden or 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
import { | |
shallowMount | |
} from '@vue/test-utils' | |
import List from '@/components/List.vue' | |
import { | |
createRenderer | |
} from 'vue-server-renderer' | |
describe('List.vue', () => { | |
it('renders li for each item in props.items', () => { |
This file contains hidden or 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
var clickCount = 0; | |
function buttonClickHandler() { | |
clickCount++; | |
document.querySelector("button[type]").innerHTML = "Clicked " + clickCount + " times"; | |
} |