Javascript
Getting Started with Deno — Deno's Built-In Tooling

Testing Your Code Solution

PRO
Outline

Here's a possible solution for testing the subtract.ts file:

import { assertEquals } from 'https://deno.land/std/testing/asserts.ts';
import { subtract } from './subtract.ts';

Deno.test('subtract 2 and 2 = 0', () => {
  const result = subtract(2, 2);
  assertEquals(result, 0);
});

Deno.test({
  name: '4 - 2 = 2',
  fn: () => {
    const result = subtract(4, 2);
    assertEquals(result, 2);
  }
});


 

I finished! On to the next chapter