Last active
July 12, 2019 02:23
-
-
Save franklsm1/a6db6dc808e560f242602d9f0d615fc1 to your computer and use it in GitHub Desktop.
A bunch of questionable / controversial code examples
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 valuableQuoteToShareBeforeSession = | |
"Remember, before you can be great, you've got to be good." + | |
"Before you can be good, you've got to be bad." + | |
"But before you can even be bad, you've got to try." + | |
"– Art Williams" | |
/*******************************************/ | |
// useless assignment and error messsage | |
/*******************************************/ | |
function setNumber(number){ | |
if (number) { | |
number = number; | |
return number; | |
} | |
else { | |
throw new Exception("Error"); | |
} | |
} | |
/*******************************************/ | |
// return !show && spacing between squiglies | |
/*******************************************/ | |
function toggleShow(show){ | |
if(show === true){ | |
show = false; | |
return show; | |
}else{ | |
show = true; | |
return show; | |
} | |
} | |
var show = true; | |
show = toggleShow(show); | |
/*******************************************/ | |
// invalid code logic | |
/*******************************************/ | |
function validateItemsExist( items ) { | |
if (items.length === 0) | |
return true; | |
return true; | |
} | |
/*******************************************/ | |
// never have if/else return true/false & constants for integers? | |
/*******************************************/ | |
function checkMyMath() { | |
const twenty = 20; | |
const eighty = 80; | |
const oneHundred = 100; | |
if (twenty + eighty === oneHundred) { | |
return true | |
} else { | |
return false; | |
} | |
} | |
/*******************************************/ | |
// PUT squiglies on same line NOW! | |
/*******************************************/ | |
function checkMySquiglies(variable) { | |
if ( variable ) | |
{ | |
return variable + "good"; | |
} | |
else | |
{ | |
return "bad" | |
} | |
} | |
/*******************************************/ | |
// I need better line coverage | |
/*******************************************/ | |
function setup() { | |
const enzymeWrapper = shallow(<SubmitButton />); | |
return { | |
enzymeWrapper | |
}; | |
} | |
describe('tests', () => { | |
it('onLogoClick', () => { | |
const { enzymeWrapper } = setup(); | |
enzymeWrapper.instance().onLogoClick(); | |
expect(true).toEqual(true); | |
}); | |
it('onMenuClick', () => { | |
const { enzymeWrapper } = setup(); | |
enzymeWrapper.instance().onMenuClick(); | |
expect(true).toEqual(true); | |
}); | |
it('renderLoginLogout', () => { | |
const { enzymeWrapper } = setup(); | |
enzymeWrapper.instance().renderLoginLogout(); | |
expect(true).toEqual(true); | |
}); | |
}); | |
/*******************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment