Skip to content

Instantly share code, notes, and snippets.

View eduardopc's full-sized avatar
💭
🚀

Eduardo Pacheco eduardopc

💭
🚀
View GitHub Profile
@eduardopc
eduardopc / json-server
Last active April 13, 2020 00:09
json-server install
npm install -g json-server
{
"movies":[
{
"id": 1,
"Title":"The Avengers",
"Year":"2012",
"Genre":"Action, Sci-Fi, Thriller",
"Actors":"Stan Lee, Robert Downey Jr., Chris Evans, Mark Ruffalo",
"Type":"movie"
},
docker run --name pactbroker --link pactbroker-db:postgres -e PACT_BROKER_DATABASE_USERNAME=pactbrokeruser -e PACT_BROKER_DATABASE_PASSWORD=root -e PACT_BROKER_DATABASE_HOST=postgres -e PACT_BROKER_DATABASE_NAME=pactbroker -d -p 9292:9292 pactfoundation/pact-broker
{
"cars":[
{
"id": 1,
"name": "Uno",
"age": "2012"
},
{
"id": 3,
"name": "Gol",
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
import 'dotenv/config';
import { Pact } from '@pact-foundation/pact';
import { eachLike, somethingLike, integer } from '@pact-foundation/pact/dsl/matchers';
import path from 'path';
import { fetchCharacters } from '../../../src/service/api';
const mockProvider = new Pact({
consumer: 'web-application',
import 'dotenv/config';
import axios from 'axios';
const baseUrl = `http://localhost:${process.env.MOCK_SERVER_PORT}`;
const fetchCharacters = async () => {
return await axios.get(`${baseUrl}/characters`);
};
MOCK_SERVER_PORT=3377
{
"name": "testes-de-contrato",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test:consumer": "jest --runInBand __tests__/contract/consumer/consumer.spec.js"
},
"keywords": [],
"author": "",
{
"consumer": {
"name": "web-application"
},
"provider": {
"name": "characters-api-application"
},
"interactions": [
{
"description": "a request to list all characters",