From 672d11c88b1c83976798de16f1de9133ccc3b314 Mon Sep 17 00:00:00 2001 From: Steve Kinney Date: Wed, 2 Oct 2024 10:28:38 -0500 Subject: [PATCH] Implement addition --- examples/basic-math/src/arithmetic.js | 4 +++- examples/basic-math/src/arithmetic.test.js | 7 ++++++- examples/scratchpad/index.js | 5 ----- 3 files changed, 9 insertions(+), 7 deletions(-) delete mode 100644 examples/scratchpad/index.js diff --git a/examples/basic-math/src/arithmetic.js b/examples/basic-math/src/arithmetic.js index ae36902..9204bff 100644 --- a/examples/basic-math/src/arithmetic.js +++ b/examples/basic-math/src/arithmetic.js @@ -1,4 +1,6 @@ -export const add = () => {}; +export const add = (a, b) => { + return a + b; +}; export const subtract = () => {}; diff --git a/examples/basic-math/src/arithmetic.test.js b/examples/basic-math/src/arithmetic.test.js index a863ed7..b9689bb 100644 --- a/examples/basic-math/src/arithmetic.test.js +++ b/examples/basic-math/src/arithmetic.test.js @@ -1,6 +1,11 @@ import { describe, it, expect } from 'vitest'; +import { add } from './arithmetic.js'; -describe.todo('add', () => {}); +describe('add', () => { + it('should add two positive numbers', () => { + expect(add(2, 2)).toBe(4); + }); +}); describe.todo('subtract', () => {}); diff --git a/examples/scratchpad/index.js b/examples/scratchpad/index.js deleted file mode 100644 index 725147d..0000000 --- a/examples/scratchpad/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { it, expect } from 'vitest'; - -it('is a super simple test', () => { - expect(true).toBe(true); -});