Skip to content

Instantly share code, notes, and snippets.

View barbaromatrix's full-sized avatar
💭
Faça esportes.

Matheus barbaromatrix

💭
Faça esportes.
View GitHub Profile
const Card = (props) => {
return (
<div>
<img width="100" src={props.avatar_url} />
<div>{props.name}</div>
<div>{props.company}</div>
</div>
);
};
import React from 'react';
import { shallow } from 'enzyme';
import PrivateRoute from './Routes.js';
const mockComponent = <h1>Test component</h1>;
describe('Routes Unit Test', () => {
describe('Happy path', () => {
test('It should render a component when isUserLogged is true', () => {
const wrapper = shallow(<PrivateRoute component={mockComponent} isUserLogged={true}/>);
const httpErrorCodes = [400, 500, 501, 504]
module.exports.checkForRequestError = (requestData, errorList = httpErrorCodes) =>
requestData.statusCode && errorList.indexOf(requestData.statusCode > -1)
module.exports.setupCouponActivationData = (requestParams, context, ee, next) => {
const coupons = context.vars.coupon_v2
const filteredCoupons = coupons.find(coupon => !coupon.active)
context.vars.coupon_v2 = filteredCoupons ? filteredCoupons : coupons[0]
@barbaromatrix
barbaromatrix / coupon_Scenario_config.yml
Last active May 7, 2019 02:25
Config of artillery scenario
config:
target: "https://you.target.api"
payload:
path: "../a_random_imported_file"
fields:
- "userId"
order: random
delimiter: ","
cast: false
tls:
scenarios:
- name: "Resource Scenario"
flow:
- get:
url: "/a/group/of/random/resources"
afterResponse: logResponse
capture:
json: $
as: data
- log: "Result: {{ data }} \n"
@barbaromatrix
barbaromatrix / functions.js
Created May 7, 2019 02:28
Artillery processor help functions
const fs = require('fs')
const httpErrorCodes = [400, 500, 501, 504]
module.exports.checkForRequestError = (requestData, errorList = httpErrorCodes) =>
requestData.statusCode && errorList.indexOf(requestData.statusCode > -1)
module.exports.setupCouponActivationData = (requestParams, context, ee, next) => {
const coupons = context.vars.coupon_v2
const filteredCoupons = coupons.find(coupon => !coupon.active)
scenarios:
- name: "Resource Scenario"
flow:
- get:
url: "/a/group/of/random/resources"
afterResponse: logResponse
capture:
json: $
as: data
- log: "Result: {{ data }} \n"
config:
target: "https://you.target.api"
payload:
path: "../a_random_imported_file"
fields:
- "userId"
order: random
delimiter: ","
cast: false
tls:
const httpErrorCodes = [400, 500, 501, 504]
module.exports.checkForRequestError = (requestData, errorList = httpErrorCodes) =>
requestData.statusCode && errorList.indexOf(requestData.statusCode > -1)
module.exports.setupActivationData = (requestParams, context, ee, next) => {
const coupons = context.vars.coupon_v2
const filteredCoupons = coupons.find(coupon => !coupon.active)
context.vars.coupon_v2 = filteredCoupons ? filteredCoupons : coupons[0]
const fs = require('fs')
const httpErrorCodes = [400, 500, 501, 504]
module.exports.checkForRequestError = (requestData, errorList = httpErrorCodes) =>
requestData.statusCode && errorList.indexOf(requestData.statusCode > -1)
module.exports.setupData = (requestParams, context, ee, next) => {
const coupons = context.vars.coupon_v2
const filteredCoupons = coupons.find(coupon => !coupon.active)