Skip to content

Instantly share code, notes, and snippets.

@nylen
Created February 15, 2016 21:23
Show Gist options
  • Save nylen/51f212025af7e7b76953 to your computer and use it in GitHub Desktop.
Save nylen/51f212025af7e7b76953 to your computer and use it in GitHub Desktop.
Test wp-calypso#3309
'use strict';
const https = require( 'https' );
JSON.stringifyCanonical = require( 'canonical-json' );
// First commit in master but not the PR branch
const parentCommitHash = '15b8aaf';
// PR branch name
const prBranchName = 'update/alphabetize-features';
function getConfigFile( branch, filename, callback ) {
https.get( {
host: 'raw.githubusercontent.com',
path: '/Automattic/wp-calypso/' + branch + '/config/' + filename
}, res => {
if ( res.statusCode === 200 ) {
let data = '';
res.on( 'data', chunk => {
data += chunk;
} ).on( 'end', () => {
callback( JSON.parse( data ) );
} );
} else {
throw new Error( 'HTTP ' + res.statusCode );
}
} );
}
[
'desktop-mac-app-store.json',
'desktop.json',
'development.json',
'horizon.json',
'production.json',
'stage.json',
'wpcalypso.json'
].forEach( filename => {
getConfigFile( parentCommitHash, filename, dataUnsorted => {
getConfigFile( prBranchName, filename, dataSorted => {
const jsonUnsorted = JSON.stringifyCanonical( dataUnsorted );
const jsonSorted = JSON.stringifyCanonical( dataSorted );
if ( jsonUnsorted === jsonSorted && dataUnsorted.features && dataSorted.features ) {
console.log( 'OK: ' + filename );
} else {
console.log( 'Not OK: ' + filename );
}
} );
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment