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
const { Verifier } = require("@pact-foundation/pact") | |
const chai = require("chai") | |
const chaiAsPromised = require("chai-as-promised") | |
chai.use(chaiAsPromised) | |
const { server, importData, animalRepository } = require("../provider.js") | |
const path = require("path") | |
server.listen(8081, () => { | |
importData() | |
console.log("Animal Profile Service listening on http://localhost:8081") |
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
const credentials = { username: "test", password: "123"} |
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
willRespondWith: { | |
status: 200, | |
body: Matchers.somethingLike(name: "Mary", age: 20) | |
} |
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
query: { | |
name: 'Mary Jame', | |
age: '8', | |
children: ['Betty', 'Sue'] | |
} |
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
body: { | |
name: "Mary", | |
age: Matchers.like(73) | |
} |
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
body: { | |
name: "Mary", | |
dateOfBirthday: Matchers.term( | |
generate: "02/11/2013", | |
matcher:/\d{2}\/\d{2}\/\d{4}/) | |
} |
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
describe('Pact Verification', () => { | |
if('should validate the contract', () => | |
let opts = { | |
customProviderHeaders: ["Authorization: Bearer tu834r93h8rygr38y4r"] | |
}; | |
return provider.verify(opts) | |
}) | |
}) |
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
$ pact-broker can-i-deploy --pacticipant Cat --version 21 --pacticipant Dog --version 32 |
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
// Bad practice | |
const EXPECTED_BODY = { | |
name: fake.name, | |
surname: fake.surname, | |
createdDate: Date.now(), | |
country: fake.country() | |
} | |
// Good practice | |
const EXPECTED_BODY = { |
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
#!/bin/bash | |
# Kill all running containers. | |
docker kill $(docker ps -q) | |
# Delete all stopped containers. | |
printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q) | |
# Delete all untagged images. |
NewerOlder