Skip to content

Instantly share code, notes, and snippets.

View AlexJukes's full-sized avatar

Alex Jukes AlexJukes

  • London, United Kingdom
View GitHub Profile
@AlexJukes
AlexJukes / jest-props-matcher.ts
Created March 7, 2023 16:15
A custom jest matcher for checking whether props have been passed to a mocked React component
expect.extend({
toReceivePropsContaining(received, expected) {
if (!received._isMockFunction) {
return {
message: () =>
`Expected: ${chalk.green(
'[A mocked React component]'
)}\nReceived: ${this.utils.printReceived(received)}`,
pass: false,
}
@AlexJukes
AlexJukes / AuthorDonationsTest.js
Last active May 22, 2017 13:35 — forked from pau1m/AuthorDonationsTest.js
AuthorDonationsTest.js
// Include web3 library so we can query accounts.
const Web3 = require('web3')
// Instantiate new web3 object pointing toward an Ethereum node.
let web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
// Include AuthorDonation contract
let AuthorDonation = artifacts.require("./AuthorDonation")
// Test with Mocha
contract('AuthorDonation', function(accounts) {
// Setup a variable to hold the contract object.