# Pony Foo

Latest articles published on Pony Foo

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Bootstrapping a UI component library

DevFeed: [Bootstrapping a UI component library](<https://devfeed.tech/articles/bootstrapping-a-ui-component-library-21872.md>)

Original publisher: [Read original article](<https://ponyfoo.com/articles/bootstrapping-a-ui-component-library>)

Author: nico@ponyfoo.com (Nicolás Bevacqua)

Published: 2021-12-16T14:38:04Z

Content type: article

Language: en

Sources: [Pony Foo](<https://devfeed.tech/sources/pony-foo.md>)

Topics: [Design system](<https://devfeed.tech/topics/design-system.md>), [Library](<https://devfeed.tech/topics/library.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [Figma](<https://devfeed.tech/topics/figma.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [article](<https://devfeed.tech/tags/article.md>), [component](<https://devfeed.tech/tags/component.md>), [design-system](<https://devfeed.tech/tags/design-system.md>), [developers](<https://devfeed.tech/tags/developers.md>), [development](<https://devfeed.tech/tags/development.md>), [figma](<https://devfeed.tech/tags/figma.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

The article explains how a startup built and adopted a UI component library called Ryu. It discusses the library's design tokens and core components, its close alignment with Figma, and how standardization separates design concerns from feature development and business logic.

### Source excerpt

Building -- and adopting -- a component library in the context of a vibrant business is no easy feat. Here are a few things we've learned. At a small startup, the timing is never quite right to start a component library. Extremely quick iteration is not usually associated with putting together a standardized set of components and conventions to use across your app, as your components and conventions change all the time in the frenzy of finding product-market fit! Nevertheless, component libraries can be tremendously valuable in separating design concerns from feature development and business logic, eventually leading to faster-than-ever iteration. In this article we'll explore what went into our component library -- we called it Ryu -- and what we left out, the tradeoffs we made along the way, and the vision for its future. Let's go! What does a component library consist of? In essence, our component library consists of colors, sizes, fonts, line heights, and even media breakpoints and z-indices. When building a component library you don't generally come up with these values, but rather you take them from what Design has already fleshed out -- probably in Figma. The role of our component library is to mirror Figma as closely as possible, so that developers need not worry about getting the design aspect of their feature work, and can instead focus on getting business logic and its edge cases right. In this sense, the component library can and should be the bridge that melds together Design, Product, and Engineering, effectively acting as the source of truth for our design system is. To that end, we need an understanding across the organization that, while Design has the last word on how the experience we offer looks and feels, Engineering requires it be standardized into a core set of functionality like inputs, buttons, tooltips, menus, tables, drawers, and anything else the designs require. This distinction essentially buckets design work into two categories: new core co

## Disguise Driven Testing: Jest Mocks In Depth -- Part 2

DevFeed: [Disguise Driven Testing: Jest Mocks In Depth -- Part 2](<https://devfeed.tech/articles/disguise-driven-testing-jest-mocks-in-depth-part-2-21876.md>)

Original publisher: [Read original article](<https://ponyfoo.com/articles/disguise-driven-testing-jest-mocks-in-depth-part-2>)

Author: jsmapr1@gmail.com (Joe Morgan)

Published: 2019-04-22T09:26:23Z

Content type: tutorial

Language: en

Sources: [Pony Foo](<https://devfeed.tech/sources/pony-foo.md>)

Topics: [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Jest](<https://devfeed.tech/topics/jest.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [Code](<https://devfeed.tech/topics/code.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [function](<https://devfeed.tech/tags/function.md>), [jest](<https://devfeed.tech/tags/jest.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

This tutorial explains how Jest mocks can isolate external data, side effects, impurities, and third-party dependencies so tests remain consistent and predictable. It demonstrates testing an employee-creation function whose default fields can be overridden while its generated key is treated as incidental.

### Source excerpt

Mocks are a great way of preventing AJAX calls in tests, but they can also help you isolate side effects and impurities that can create complicated tests. As you learned in Part 1, mocks are a great way to handle external data or any data that is likely to change. Mocking external data will likely be your most common use case and for a good reason. You want your tests to stick as closely to your code as possible this includes all dependencies. Still, there are times when a dependency creates a testing specific problem. In other words, the code works as you would want it to in production, but in a testing environment can make consistent, predictable tests hard or nearly impossible. Some of your third party code may have side effects or some form of impurity that will complicate your testing. Maybe the code has certain expectations of the DOM. Maybe it will change slightly depending on the order of operations. In all cases, the code is out of your control, but you need it to be predictable. Creating Predictable Outcomes with Mocks Suppose you have an application that manages employees or users. You need to make a simple function that will create a new employee, but you want to make sure that the employee always contains certain fields and will have a unique id. Your code will look something like this: import uniqueId from 'lodash/uniqueId' export function createEmployee(details) { return { name: '', position: '', ...details, key: uniqueId() } } In this case, you are using the Lodash method uniqueId to, well, create a unique ID. Specifically you are creating a key that you can use if you do any manipulations on an array of employees. The key, though, is a minor thing. For the most part, your tests should focus on other aspects of your code such as ensuring default fields while allowing those fields to override. Here are two simple tests. import { createEmployee, } from './utils' describe('createEmployee', () => { it('should create a blank employee', () => { const blank

## Conflict Resolution and Code Reviews

DevFeed: [Conflict Resolution and Code Reviews](<https://devfeed.tech/articles/conflict-resolution-and-code-reviews-21873.md>)

Original publisher: [Read original article](<https://ponyfoo.com/articles/conflict-resolution-and-code-reviews>)

Author: nico@ponyfoo.com (Nicolás Bevacqua)

Published: 2019-04-10T10:00:46Z

Content type: tutorial

Language: en

Sources: [Pony Foo](<https://devfeed.tech/sources/pony-foo.md>)

Topics: [Code review](<https://devfeed.tech/topics/code-review.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>), [Git](<https://devfeed.tech/topics/git.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [checkout](<https://devfeed.tech/tags/checkout.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [code-reviews](<https://devfeed.tech/tags/code-reviews.md>), [git](<https://devfeed.tech/tags/git.md>), [git-commit](<https://devfeed.tech/tags/git-commit.md>), [github](<https://devfeed.tech/tags/github.md>), [tips](<https://devfeed.tech/tags/tips.md>)

### AI overview

A tutorial on reviewing conflict resolution in large Git pull requests. It shows how to recreate the merge with conflict markers locally so reviewers can isolate and inspect the changes made to resolve conflicts, while ignoring unrelated branch changes.

### Source excerpt

Have you ever tried to do a code review on a PR that merges a large release branch or feature branch back into mainline, fixing merge conflicts? It's not pretty. The diffs are often and easily very big, -- 50k+ LOC big -- have hundreds of commits, and the actual changes made by the engineer resolving the merge conflicts are virtually impossible to spot. This article covers one nifty trick I've been using lately in these cases that lets you review exactly the conflict resolution, while ignoring the mountains of changes that don't represent any conflicts (and can thus be safely ignored). Check out the PR locally If you haven't done this before, you can just add the author's remote (provided they're using a fork, otherwise you can skip this step) like so: $ git remote add nico https://github.com/nico/repo.git Then we can fetch the PR branch, let's assume it's called fix-merge-conflicts and it was merging branch-with-conflicts into master, fixing the conflicts along the way: $ git fetch nico fix-merge-conflicts $ git checkout fix-merge-conflicts Assess the situation The git log should indicate they've merged a couple branches. The commit hashes are the key bits here. $ git log -1 HEAD commit a9c9ed7gcc0a76670d86df4b732f1f219ccb48de (HEAD -> fix-merge-conflicts) Merge: aecf730802 ba9918dad5 Author: Bloodninja <bloodninja@usenet.org> Date: Mon Apr 8 12:32:38 2019 +0000 Merge remote-tracking branch 'branch-with-conflicts' And now we can verify that these indeed belong to each of the branches we care about: $ git branch --contains=aecf730802 master * fix-merge-conflicts $ git branch --contains=ba9918dad5 branch-with-conflicts * fix-merge-conflicts Now for the magic git checkout -b what-were-they-thinking git reset --hard aecf730802 git merge --no-ff ba9918dad5 # this will conflict git add . git commit -m WIP At this point, what-were-they-thinking is the version of the conflict resolution where you just committed things exactly as git merge left them, conflict markers and all.

## GraphQL in Depth: What, Why, and How

DevFeed: [GraphQL in Depth: What, Why, and How](<https://devfeed.tech/articles/graphql-in-depth-what-why-and-how-21877.md>)

Original publisher: [Read original article](<https://ponyfoo.com/articles/graphql-in-depth-what-why-and-how>)

Author: ryan.glover@cleverbeagle.com (Ryan Glover)

Published: 2019-03-12T12:01:43Z

Content type: tutorial

Language: en

Sources: [Pony Foo](<https://devfeed.tech/sources/pony-foo.md>)

Topics: [GraphQL](<https://devfeed.tech/topics/graphql.md>), [API](<https://devfeed.tech/topics/api.md>), [CRUD](<https://devfeed.tech/topics/crud.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [code](<https://devfeed.tech/tags/code.md>), [crud](<https://devfeed.tech/tags/crud.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [rest](<https://devfeed.tech/tags/rest.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

An in-depth tutorial introducing GraphQL, explaining how it works, how it compares with REST, and how to use types, queries, mutations, and schemas to build a simple API.

### Source excerpt

GraphQL is all the rage, but what exactly is it? In this in-depth walkthrough, we take a look at what GraphQL is, how to use it, and why you should use it. Learn why GraphQL is all the rage! We'll walk through the implementation of a schema for a popcorn company's API, learning about types, queries, and mutations as we go. I love popcorn. As I'm writing this, I'm snacking on a bowl of multi-colored kernels, lightly seasoned with Flavacol (hint: this is the movie theater's secret) and I'm feeling a twinge of hubris in my eye... "I should start a popcorn company..." Well, that's a terrible idea, Ryan! But, for the sake of this tutorial, it's the best idea you've had all week. In this tutorial, we're going to learn how to create a simple, GraphQL-based API for a popcorn company. All we need is a name. Seeing as how I'm quite fond of sarcasm, how about... Sarcastic Kernels: The Popcorn You Love to Hate to Eat™ Perfect! And like any self-respecting nerd, it only seems right to start writing some code before we come up with a sound business plan. To get started, let's wrap our heads around what GraphQL is and how it compares to REST. What is GraphQL? GraphQL is a client-side query language coupled with a pattern -- formally known as a "schema" -- for organizing the creation, reading, updating, and deleting of data in your application (yeah, that CRUD). We say "application", here, and not database because GraphQL is data-source-agnostic, meaning it doesn't care where your data lives. From the outside looking in, GraphQL can seem quite scary. Does the "Graph" part mean I have to learn about graph databases? Does the QL (query language) mean I have to learn I have to learn a brand new programming language?! Not quite. To calm your nerves, the harsh truth is: GraphQL is just a dressed up GET or POST request. Wait, what?! Yep. While GraphQL as a whole does introduce some new concepts for organizing and interacting with your data, behind the curtain, GraphQL still relies on a good ol'