Showing posts from January, 2020

How do you find conferences to speak at?

Ahead of the Global Diversity CFP Day that I and some others are organising in Newcastle I was thinking of what questions I'd ask. A question that has always bothered me is how do speakers find out about conferences in time to submit a proposal?

I went to Twitter to see what help I could get from the wider community.
For those of you who speak at dev conferences in Australia how do you find out about conferences and CFPs? Asking for me but also to tell people next week at @gdcfpday. — Klee Thomas (@kleeut) January 9, 2020
The answer I got from people on Twitter was largely to follow some accounts on Twitter.

For ease I've combined these into a Twitter list

The other suggestion was to follow conferences that you're interested in on Twitter.
I've also got a Twitter List for conferences. By virtue of the fact that I'm…

Testing functions that use local storage with Jest

Testing functions that use the browsers local storage API seems easy when you know how. Here's a quick run down on how to mock it out with Jest if, like me, you're not familiar with how to test it. In the end it's very little code. Consider the following TypeScript code.

import { get, save, key } from "./storage"; describe(save, () => { let setItem: jest.Mock; beforeEach(() => { setItem = jest.fn(); Storage.prototype.setItem = setItem; }); it("should call set item with predefined key and json object", () => { const valueToStore = { value: "toStore" }; save(valueToStore); expect(setItem).toHaveBeenCalledWith(key, JSON.stringify(valueToStore)); }); });
The key lines are in the beforeEach call where the setItem function of the Storage prototype is assigned to an instance of jest.fn(). This allows us to make assertions on what is passed to the local storage setItem API.