# Computability, types, tests, and why flat-earthers are bad at QA

When an apple hit Newton’s head, he couldn’t prove all apples would do the same, but he could prove they wouldn’t. When we write tests, we cannot prove our code works, we can only prove it doesn’t. Types complement tests like mathematics complement physics, in this talk we’ll see why, and how.

This talk is as much of a journey through epistemology as it is a journey through software testing. How can we prove correctness is not the right question to ask. The right question to ask is: "Can we ever prove correctness?"

We’ll explore and compare the parallels between mathematics and physics, and types and tests. If physics cannot prove its theories are truthful, why do we believe it? We believe it for the same reason we believe in tests: we make observations, create models and check if reality matches our assumptions. When we have a formal system with well-defined rules, such as we have in mathematics, things change: truth is now attainable. We’ll explore the most brilliant ideas in the field of computer science and see how they can be applied to make better software, faster, with fewer bugs.

Going beyond theory, we’ll see how we can better use TypeScript’s features to make impossible states indeed impossible by using generics, conditional types, intersection and union types, discriminated unions and exhaustiveness checking and many others, after all, since TypeScript is Turing Complete, with it we can write any program that has ever been written or that will ever be written.

Getting even more practical, we’ll see what testing tools are available to us and how they complement each other: we’ll dig deep in the differences between how these tools work so that we can make informed choices about them and what is the role of each. We’ll talk about the difference between the different kinds of tests, end-to-end tests, snapshot testing, serializers, mocks, stubs, spies, and tight and loose assertions. Whenever necessary, we’ll go into the source code of some of JavaScript’s most popular libraries to show you all the mind-blowing minutiae in the way they have been implemented.

Комментарий программного комитета:

Какое отношение тесты имеют к экспериментам в физике? Лукас решил зайти с философии и охватить все известные на данный момент аспекты тестирования: юнит-тесты, E2E, типы, спапшоты, и не только.

Lucas is a Brazilian software engineer living in London. He breathes JavaScript and is passionate about open source. He is a core team member of Chai.js and Sinon.js, two of the most popular libraries in the JS ecosystem, and is always trying to find better and more efficient ways to solve problems. His motto is "strive to be lazy".