Skip to content

Instantly share code, notes, and snippets.

@mledom
mledom / cypress-example.js
Last active August 27, 2018 01:46
Cypress test checking that our welcome message appears
describe('"/eletype welcome" should have welcome message with components', () => {
beforeEach(() => {
cy.server();
cy.route('POST', '*conversations.mark*').as('commandReturn');
});
it('Type Welcome command and wait for response', () => {
cy.get('#msg_input > .ql-editor').type('/eletype welcome')
//this is an alias that waits for the return message
//to appear after typing in the command
cy.wait('@commandReturn')
describe('welcomeInstallHandler', () => {
it('sends welcome msg', () => {
const msgMock = jest.fn().mockResolvedValue(null);
SlackClient.mockImplementation(() => {
return {
say: msgMock,
};
});
const event = {
slackWorkspace: {
@mledom
mledom / 0_reuse_code.js
Created August 14, 2014 13:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mledom
mledom / Ajaxed in form
Created October 16, 2012 20:15
URL ajax form
<div class='hidden title'>New Link</div>
<form accept-charset="UTF-8" action="/urls" class="new_url" data-validate="true" id="new_url" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="E800evqLMvkkuaodl+uiE0xHGr9OFhVQfSK+S+dHwEo=" /></div>
<i class='external-link-icon hidden'></i>
<div class='section'>
<h3 class='section-title'>
<i class='details-icon icon-large'></i>
Details
</h3>
<div class='section-content'>
<div class='field'>