// TODO: Add your tests here // Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework. // [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework) // are still available for now. // // For new tests, using [Chai](https://chaijs.com/) is recommended. // You can use it by requiring: // const assert = require("chai").assert; // If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted. describe("Solution", function() { it("should test for something", function() { Test.assertEquals(av(-1),1); Test.assertEquals(av(-1.41313), 1.41313); Test.assertEquals(av(-22.22), 22.22); }); });
- // TODO: Add your tests here
- // Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
- // [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
- // are still available for now.
- //
- // For new tests, using [Chai](https://chaijs.com/) is recommended.
- // You can use it by requiring:
- // const assert = require("chai").assert;
- // If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
- describe("Solution", function() {
- it("should test for something", function() {
// Test.assertEquals(1 + 1, 2);// assert.strictEqual(1 + 1, 2);- Test.assertEquals(av(-1),1);
- Test.assertEquals(av(-1.41313), 1.41313);
- Test.assertEquals(av(-22.22), 22.22);
- });
- });
function getChange(allPrice,youMoney) { return parseFloat((youMoney-allPrice).toFixed(1)); }
function getChange(allPrice,youMoney){return parseFloat((1-(allPrice/youMoney)).toFixed(4))*youMoney;- function getChange(allPrice,youMoney) {
- return parseFloat((youMoney-allPrice).toFixed(1));
- }
describe("Solution", function() { it("should test for something", function() { Test.assertEquals(getChange(4,10), 6); Test.assertEquals(getChange(4,100), 96); Test.assertEquals(getChange(4.5,100), 95.5); Test.assertEquals(getChange(3.5,5), 1.5); Test.assertEquals(getChange(3.8,5), 1.2); Test.assertEquals(getChange(3.7435,8.124444), 4.4); // assert.strictEqual(1 + 1, 2); }); });
- describe("Solution", function() {
- it("should test for something", function() {
- Test.assertEquals(getChange(4,10), 6);
- Test.assertEquals(getChange(4,100), 96);
- Test.assertEquals(getChange(4.5,100), 95.5);
- Test.assertEquals(getChange(3.5,5), 1.5);
- Test.assertEquals(getChange(3.8,5), 1.2);
- Test.assertEquals(getChange(3.7435,8.124444), 4.4);
- // assert.strictEqual(1 + 1, 2);
- });
- });