Skip to content

Instantly share code, notes, and snippets.

View toranb's full-sized avatar

Toran Billups toranb

View GitHub Profile
@toranb
toranb / proposal.md
Created June 26, 2018 22:54
Over mocking under delivering

#Abstract

The Ember community has a strong testing culture, but advanced topics like the intersection of integration and isolation testing can be as confusing as they are controversial. To make matters worse we are often tricked into believing that a mock library has the answer to all of our problems, making it difficult to evaluate when to use mocks (or even avoid them).

This talk will give you a fresh perspective on the use and abuse of mock objects, explore why this topic is crucial for test suite reliability, and equip developers with strategies to make these distinctions without the guesswork.

#Details

For years now I've had varying degrees of success with mock objects but until recently I didn't have a narrative in which to tell the story of "good mock/bad mock"

@toranb
toranb / missing-message.js
Created February 23, 2018 23:18
missing message implementation for ember-i18n to support default locale "fallback"
import { getOwner } from '@ember/application';
import { typeOf } from '@ember/utils';
// https://github.com/jamesarosen/ember-i18n/blob/61086238bb507922fbf458f98fd44fd6e0a24a4e/addon/utils/locale.js#L150
function withFlattenedKeys(object) {
const result = {};
Object.keys(object).forEach(function(key) {
var value = object[key];
@toranb
toranb / components.number-count.js
Last active December 29, 2018 16:47
es2015 class syntax (ember redux)
import Ember from 'ember';
import { connect } from 'ember-redux';
import hbs from 'htmlbars-inline-precompile';
const stateToComputed = state => ({
number: state.number
});
const dispatchToActions = dispatch => ({
add: () => dispatch({type: 'ADD'})
require 'watir-webdriver'
include Selenium
describe "Acceptance tests" do
before :each do
@b = Watir::Browser.new :firefox
end
after :each do
@b.close
import Component, { tracked } from '@glimmer/component';
import { createStore } from 'redux';
const reducers = (state, action) => {
if(action.type === 'ADD') {
return state + 1;
}
return state || 0;
};
const store = createStore(reducers);
@toranb
toranb / index.js
Created October 7, 2017 20:52
post processing css with ember-cli to work around libsass blocker
/* eslint-env node */
'use strict';
const path = require('path');
const replace = require('broccoli-replace');
const Merge = require('broccoli-merge-trees');
module.exports = {
name: 'replacc',
@toranb
toranb / actions.items.js
Last active September 13, 2018 11:24
New Twiddle
export const updateItem = (id, name) => dispatch => dispatch({type: 'UPDATE_ITEM', id, name});
export const toggleEdit = (id, value) => dispatch => dispatch({type: 'TOGGLE_EDIT', id, value});
@toranb
toranb / components.customize-me.js
Last active September 13, 2018 11:37
New Twiddle
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import { connect } from 'ember-redux';
const stateToComputed = state => {
return {
name: state.data.name,
loading: state.data.loading
};
};
import Ember from 'ember';
import hbs from 'htmlbars-inline-precompile';
import { connect } from 'ember-redux';
const stateToComputed = state => {
return {
number: state.saga.number,
loading: state.saga.loading
};
};