Introducing: Blocks Testing NPM Package Beta

Hi all,

We’re excited to release an open beta of a new Blocks Testing package!

This new npm package will make it much easier to write tests for the apps that you build - crucially, without having to rely on the Airtable backend to run your block in a testing environment.

With the Blocks Testing package, you’re able to create a new test driver instance:


import TestDriver from '@airtable/blocks-testing';

import MyApp from '../frontend/my-app';

const testDriver = new TestDriver({
/* test fixture data here */
});

render(
  <testDriver.Container>
    <MyApp />
  </testDriver.Container>,
);

Add input to the app:

await testDriver.base.createTableAsync('a new table', [
  {name: 'address', type: FieldType.EMAIL},
]);

And verify that the app works as expected:

const checkbox = screen.getByRole('checkbox');
expect(checkbox.checked).toBe(true);

The Blocks Testing package is compatible with many popular testing frameworks, so you can choose your favorite way to write your tests.

We’ve published a new guide that walks you through how to set up and use this new testing package.

We’ve also updated our Todo List and Update Record example blocks with new example tests, to show you how you might write these tests in practice.

Our ultimate goal is for our Airtable blocks platform to better support increasingly powerful, large-scale apps, and automated testing is a crucial component of this.

As always, we’d love your feedback on this new Blocks Testing package!

9 Likes

Can’t find up-to-date info right now, so just wanted to drop a line here - what’s the highest Node version currently being supported? Been having some trouble with my environment over the past few weeks and they always seem to disappear when I dowgrade a few node projects. So yeah, water is wet and your docs are pretty good for a beta but this one tidbit is currently eluding me.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.