Skip to content

Instantly share code, notes, and snippets.

@jordanwalsh23
jordanwalsh23 / postman-local-mock-server.js
Last active June 20, 2024 07:12
Run a Postman Mock Server on Localhost
const PostmanLocalMockServer = require('@jordanwalsh23/postman-local-mock-server');
const fs = require("fs");
const PORT = process.env.PORT || 3002;
//Create the collection object.
let collection = JSON.parse(fs.readFileSync('./collection.json', 'utf8'));
//Create a new server
let server = new PostmanLocalMockServer(PORT, collection);
@jordanwalsh23
jordanwalsh23 / test-project-pre-request.js
Last active February 5, 2024 04:47
Pre-Request Script for Postman Testing Framework
//Set the Test Case ID
pm.collectionVariables.set("testCaseId", pm.execution.location[pm.execution.location.length - 2]);
failTest = (_pm, testFailedException) => {
let testCaseId = _pm.collectionVariables.get("testCaseId")
let results = JSON.parse(_pm.collectionVariables.get("results") || "{}");
console.log("Checking Test: ", testCaseId);
console.log("Got Results", results)
{
"val" : 1
}
@jordanwalsh23
jordanwalsh23 / Postman Workspace Description Margin Fix.userscript.js
Last active April 28, 2022 04:09
Tampermonkey Script to fix documentation display issues in postman
// ==UserScript==
// @name Postman Workspace Description Margin Fix
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Fix margin issue on documentation pages.
// @author Jordan Walsh
// @match https://*.postman.co/*
// @match https://*.postman.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=postman.co
// @grant none
@jordanwalsh23
jordanwalsh23 / bitbucket-pipeline.yaml
Created February 17, 2022 03:25
Bitbucket Pipeline Newman Example
image: postman/newman
pipelines:
default:
- step:
script:
- newman --version
- npm install -g newman-reporter-html
- newman run ./postman/collections/<collection_name>.json -e ./postman/environments/<environment_name>.json --reporters cli,html --reporter-html-export report.html
artifacts:
@jordanwalsh23
jordanwalsh23 / swagger.json
Created February 24, 2020 11:08
DataVic Open Data API
{}
// ==UserScript==
// @name Trello-Horizontal-Plugin
// @namespace http://www.heyshmu.com/
// @version 0.1
// @description Converts Trello to a horizontal view
// @author Jordan Walsh (info@heyshmu.com)
// @match https://trello.com/*
// @grant GM_addStyle
// ==/UserScript==
@jordanwalsh23
jordanwalsh23 / index.js
Created May 4, 2017 02:35
Developers Guide to Lending - Full Code Example
/**
* Developers Guide to Lending in Xero
* Author: Jordan Walsh
* Date: 4 May 2017
* Description:
* This script creates the necessary components to write back a loan into Xero.
*
* This should only be run on a Demo company and NEVER used in a live environment.
*
* This code is made available at your own risk.
@jordanwalsh23
jordanwalsh23 / 9.Attachment.js
Created May 4, 2017 01:33
Developers Guide to Lending - Snippet 8
//Dependencies
const fs = require('fs')
//Attach the loan agreement to the Contact
let loanContract = {
FileName: "loanContract.pdf",
MimeType: "application/pdf"
}
let filePath = "/path/to/some/loanContract.pdf"
@jordanwalsh23
jordanwalsh23 / 8.AccPayInvoices.js
Created May 4, 2017 01:00
Developers Guide to Lending - Snippet 7
let invoiceTemplate = {
Type: 'ACCPAY',
Status: 'AUTHORISED',
Contact: {
ContactID: contactID
},
LineItems: [],
Reference: `LOAN Loan Id ${loanID}/`
}