+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/src/__test__/calculate.test.js b/src/__test__/calculate.test.js
new file mode 100644
index 0000000..a94a488
--- /dev/null
+++ b/src/__test__/calculate.test.js
@@ -0,0 +1,77 @@
+import calculate from '../logic/calculate.js';
+
+describe('Calculates user inputs correctly', () => {
+ it('AC input should return null for all object elements', () => {
+ const obj = {
+ total: '5',
+ next: '4',
+ operation: '+',
+ };
+ expect(calculate(obj, 'AC')).toEqual({
+ total: null,
+ next: null,
+ operation: null,
+ });
+ });
+
+ it('should return empty object if total and next are zero values', () => {
+ const obj = {
+ total: '0',
+ next: '0',
+ operation: null,
+ };
+ expect(calculate(obj, '0')).toEqual({});
+ });
+
+ it('should return calculated sum of 10', () => {
+ const obj = {
+ total: '5',
+ next: '5',
+ operation: '+',
+ };
+ expect(calculate(obj, '=')).toEqual({
+ next: null,
+ operation: null,
+ total: '10',
+ });
+ });
+
+ it('should return calculated product 0f 200', () => {
+ const obj = {
+ total: '10',
+ next: '20',
+ operation: 'x',
+ };
+ expect(calculate(obj, '=')).toEqual({
+ next: null,
+ operation: null,
+ total: '200',
+ });
+ });
+
+ it('+/- input should return negative value', () => {
+ const obj = {
+ total: null,
+ next: '5',
+ operation: null,
+ };
+ expect(calculate(obj, '+/-')).toEqual({
+ next: '-5',
+ operation: null,
+ total: null,
+ });
+ });
+
+ it('. input should return a decimal point', () => {
+ const obj = {
+ total: null,
+ next: '9',
+ operation: null,
+ };
+ expect(calculate(obj, '.')).toEqual({
+ next: '9.',
+ operation: null,
+ total: null,
+ });
+ });
+});
diff --git a/src/__test__/operate.test.js b/src/__test__/operate.test.js
new file mode 100644
index 0000000..d184de3
--- /dev/null
+++ b/src/__test__/operate.test.js
@@ -0,0 +1,44 @@
+import operate from '../logic/operate.js';
+
+const one = 10;
+const two = 50;
+
+test('the sum of one and two to equal 60', () => {
+ expect(operate(one, two, '+')).toEqual('60');
+});
+
+test('the sum of one and two not to equal 30', () => {
+ expect(operate(one, two, '+')).not.toEqual('30');
+});
+
+test('the difference of one and two to equal -40', () => {
+ expect(operate(one, two, '-')).toEqual('-40');
+});
+
+test('the difference of one and two not to equal 70', () => {
+ expect(operate(one, two, '-')).not.toEqual('70');
+});
+
+test('the multiplication of one and two to equal 500', () => {
+ expect(operate(one, two, 'x')).toEqual('500');
+});
+
+test('the multiplication of one and two not to equal 50', () => {
+ expect(operate(one, two, 'x')).not.toEqual('50');
+});
+
+test('the division of one and two to equal 0.2', () => {
+ expect(operate(one, two, '÷')).toEqual('0.2');
+});
+
+test('the division of one and two not to equal 12', () => {
+ expect(operate(one, two, '÷')).not.toEqual('12');
+});
+
+test('the modulus of one and two to equal 10', () => {
+ expect(operate(one, two, '%')).toEqual('10');
+});
+
+test('the modulus of one and two not to equal 0.1', () => {
+ expect(operate(one, two, '%')).not.toEqual('0.1');
+});