diff --git a/package-lock.json b/package-lock.json index 7f14e8096..3899eaec4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "curriculum", - "version": "8.4.0", + "version": "8.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "curriculum", - "version": "8.4.0", + "version": "8.5.0", "license": "CC-BY-SA-4.0", "dependencies": { "@emotion/react": "^11.11.4", @@ -38,7 +38,7 @@ "@testing-library/user-event": "^14.5.2", "@vitejs/plugin-react": "^4.2.1", "buffer": "^6.0.3", - "chai": "^4.4.1", + "chai": "^5.1.0", "chokidar": "^3.6.0", "concurrently": "^8.2.2", "dotenv": "^16.4.5", @@ -4434,6 +4434,66 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/@vitest/expect/node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/@vitest/expect/node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@vitest/expect/node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@vitest/expect/node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@vitest/expect/node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/@vitest/runner": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.4.0.tgz", @@ -4902,12 +4962,12 @@ } }, "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "engines": { - "node": "*" + "node": ">=12" } }, "node_modules/ast-types-flow": { @@ -5366,21 +5426,28 @@ } }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.0.tgz", + "integrity": "sha512-kDZ7MZyM6Q1DhR9jy7dalKohXQ2yrlXkk59CR52aRKxJrobmlBNqnFQxX9xOX8w+4mz8SYlKJa/7D7ddltFXCw==", "dev": true, "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "assertion-error": "^2.0.1", + "check-error": "^2.0.0", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=12" + } + }, + "node_modules/chai/node_modules/loupe": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.0.tgz", + "integrity": "sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.1" } }, "node_modules/chalk": { @@ -5441,15 +5508,12 @@ } }, "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.0.0.tgz", + "integrity": "sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==", "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, "engines": { - "node": "*" + "node": ">= 16" } }, "node_modules/chokidar": { @@ -5966,13 +6030,10 @@ } }, "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.1.tgz", + "integrity": "sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==", "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, "engines": { "node": ">=6" } @@ -11476,12 +11537,12 @@ "dev": true }, "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", "dev": true, "engines": { - "node": "*" + "node": ">= 14.16" } }, "node_modules/picocolors": { @@ -13881,6 +13942,57 @@ } } }, + "node_modules/vitest/node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/vitest/node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/vitest/node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/vitest/node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/vitest/node_modules/execa": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", @@ -14003,6 +14115,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/vitest/node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/vitest/node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", diff --git a/package.json b/package.json index 451b5cd00..9734507bb 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "8.5.0", "description": "Proyectos y tópicos del curriculum del Bootcamp de @Laboratoria", "repository": "Laboratoria/curriculum", + "type": "module", "keywords": [ "javascript", "laboratoria", @@ -19,7 +20,7 @@ "scripts": { "mdlint": "mdlint .", "eslint": "eslint topics/", - "test:topics": "mocha './topics/!(node_modules)/**/*.spec.js' --verbose", + "test:topics": "mocha './topics/!(node_modules)/**/discount.spec.js' --verbose", "test:scripts": "mocha './scripts/test/*.spec.mjs' --verbose", "pretest": "npm run mdlint && npm run eslint && npm run validate && npm run test:topics", "validate": "node ./scripts/build.mjs --validate", @@ -64,7 +65,7 @@ "@testing-library/user-event": "^14.5.2", "@vitejs/plugin-react": "^4.2.1", "buffer": "^6.0.3", - "chai": "^4.4.1", + "chai": "^5.1.0", "chokidar": "^3.6.0", "concurrently": "^8.2.2", "dotenv": "^16.4.5", diff --git a/topics/.eslintrc b/topics/.eslintrc index 028f7fd0b..6f55aeed0 100644 --- a/topics/.eslintrc +++ b/topics/.eslintrc @@ -12,6 +12,7 @@ "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0, "maxBOF": 0 }], "jsx-a11y/href-no-hash": "off", "jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }], + "import/extensions": "off", "import/no-extraneous-dependencies": ["error", { "devDependencies": [ "topics/javascript/**/*" diff --git a/topics/functional/01-state/02-practice/01-discount/boilerplate/discount.js b/topics/functional/01-state/02-practice/01-discount/boilerplate/discount.js index b14c1886a..21f834fe2 100644 --- a/topics/functional/01-state/02-practice/01-discount/boilerplate/discount.js +++ b/topics/functional/01-state/02-practice/01-discount/boilerplate/discount.js @@ -11,4 +11,4 @@ const applyDiscount = (cart) => { return [current].concat(applyDiscount(cart)); }; -module.exports = applyDiscount; +export default applyDiscount; diff --git a/topics/functional/01-state/02-practice/01-discount/solution/discount.js b/topics/functional/01-state/02-practice/01-discount/solution/discount.js index f203512f8..211be8e76 100644 --- a/topics/functional/01-state/02-practice/01-discount/solution/discount.js +++ b/topics/functional/01-state/02-practice/01-discount/solution/discount.js @@ -43,4 +43,4 @@ const applyDiscount = (cart, discount) => { // })].concat(applyDiscount(cart.slice(1), discount)); -module.exports = applyDiscount; +export default applyDiscount; diff --git a/topics/functional/01-state/02-practice/01-discount/test/discount.spec.js b/topics/functional/01-state/02-practice/01-discount/test/discount.spec.js index 2fbd61268..efa82810a 100644 --- a/topics/functional/01-state/02-practice/01-discount/test/discount.spec.js +++ b/topics/functional/01-state/02-practice/01-discount/test/discount.spec.js @@ -1,13 +1,13 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/discount'); +import { assert } from 'chai'; +import Submission from '../solution/discount.js'; -describe('applyDiscount()', () => { +describe('applyDiscount() ', () => { it('debería devolver un nuevo array', () => { const cart = []; const result = Submission(cart, .2); - Assert.notStrictEqual(cart, result); + assert.notStrictEqual(cart, result); }); it('debería devolver un array con mismo length que input', () => { @@ -15,7 +15,7 @@ describe('applyDiscount()', () => { [], [{ price: 1 }], [{ price: 1 }, { price: 7 }, { price: 19 }] - ].forEach(cart => Assert.equal(cart.length, Submission(cart, .2).length)); + ].forEach(cart => assert.equal(cart.length, Submission(cart, .2).length)); }); it('no debería mutar array de entrada', () => { @@ -24,13 +24,13 @@ describe('applyDiscount()', () => { const item3 = { price: 3 }; const cart = [item1, item2, item3]; const cartWithDiscount = Submission(cart, .3); - Assert.strictEqual(cart.length, 3); - Assert.strictEqual(cart[0], item1); - Assert.strictEqual(cart[1], item2); - Assert.strictEqual(cart[2], item3); - Assert.deepEqual(cart[0], { price: 1 }); - Assert.deepEqual(cart[1], { price: 2 }); - Assert.deepEqual(cart[2], { price: 3 }); + assert.strictEqual(cart.length, 3); + assert.strictEqual(cart[0], item1); + assert.strictEqual(cart[1], item2); + assert.strictEqual(cart[2], item3); + assert.deepEqual(cart[0], { price: 1 }); + assert.deepEqual(cart[1], { price: 2 }); + assert.deepEqual(cart[2], { price: 3 }); }); it('no debería mutar objetos', () => { @@ -39,10 +39,10 @@ describe('applyDiscount()', () => { const item3 = { price: 3 }; const cart = [item1, item2, item3]; const cartWithDiscount = Submission(cart, .3); - Assert.strictEqual(cart.length, 3); - Assert.strictEqual(cart[0].price, 1); - Assert.strictEqual(cart[1].price, 2); - Assert.strictEqual(cart[2].price, 3); + assert.strictEqual(cart.length, 3); + assert.strictEqual(cart[0].price, 1); + assert.strictEqual(cart[1].price, 2); + assert.strictEqual(cart[2].price, 3); }); it('debería retornar objetos con descuento indicado', () => { @@ -51,9 +51,9 @@ describe('applyDiscount()', () => { const item3 = { price: 3 }; const cart = [item1, item2, item3]; const cartWithDiscount = Submission(cart, .3); - Assert.strictEqual(cartWithDiscount[0].price, 1 * (1 - .3)); - Assert.strictEqual(cartWithDiscount[1].price, 2 * (1 - .3)); - Assert.strictEqual(cartWithDiscount[2].price, 3 * (1 - .3)); + assert.strictEqual(cartWithDiscount[0].price, 1 * (1 - .3)); + assert.strictEqual(cartWithDiscount[1].price, 2 * (1 - .3)); + assert.strictEqual(cartWithDiscount[2].price, 3 * (1 - .3)); }); }); diff --git a/topics/functional/01-state/02-practice/02-serialize-user/boilerplate/serializeUser.js b/topics/functional/01-state/02-practice/02-serialize-user/boilerplate/serializeUser.js index fe69b8acf..9c2531641 100644 --- a/topics/functional/01-state/02-practice/02-serialize-user/boilerplate/serializeUser.js +++ b/topics/functional/01-state/02-practice/02-serialize-user/boilerplate/serializeUser.js @@ -4,4 +4,4 @@ const serializeUser = user => { return JSON.stringify(user); }; -module.exports = serializeUser; +export default serializeUser; diff --git a/topics/functional/01-state/02-practice/02-serialize-user/solution/serializeUser.js b/topics/functional/01-state/02-practice/02-serialize-user/solution/serializeUser.js index 972588ef1..ec6ca3e6f 100644 --- a/topics/functional/01-state/02-practice/02-serialize-user/solution/serializeUser.js +++ b/topics/functional/01-state/02-practice/02-serialize-user/solution/serializeUser.js @@ -3,4 +3,4 @@ const serializeUser = user => JSON.stringify(Object.assign({}, user, { date: user.date.toJSON(), })); -module.exports = serializeUser; +export default serializeUser; diff --git a/topics/functional/01-state/02-practice/02-serialize-user/test/serializeUser.spec.js b/topics/functional/01-state/02-practice/02-serialize-user/test/serializeUser.spec.js index a163daba5..d1bb2a1f0 100644 --- a/topics/functional/01-state/02-practice/02-serialize-user/test/serializeUser.spec.js +++ b/topics/functional/01-state/02-practice/02-serialize-user/test/serializeUser.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/serializeUser'); +import { assert } from 'chai'; +import Submission from '../solution/serializeUser.js'; describe('serializeUser()', () => { @@ -12,7 +12,7 @@ describe('serializeUser()', () => { date: new Date() }; const dateStr = grace.date.toJSON(); - Assert.equal( + assert.equal( Submission(grace), `{"userId":"xxx","name":"Grace H...","country":"us","date":"${dateStr}"}` ); @@ -26,8 +26,8 @@ describe('serializeUser()', () => { date: new Date() }; Submission(grace); - Assert.equal(grace.name, 'Grace Hopper'); - Assert.ok(grace.date instanceof Date); + assert.equal(grace.name, 'Grace Hopper'); + assert.ok(grace.date instanceof Date); }); }); diff --git a/topics/functional/01-state/04-practice-2/01-parse-items/boilerplate/parseItems.js b/topics/functional/01-state/04-practice-2/01-parse-items/boilerplate/parseItems.js index 1b815a8d2..d9c5c91bc 100644 --- a/topics/functional/01-state/04-practice-2/01-parse-items/boilerplate/parseItems.js +++ b/topics/functional/01-state/04-practice-2/01-parse-items/boilerplate/parseItems.js @@ -5,4 +5,4 @@ const parseItems = (items) => { return items.sort(); }; -module.exports = parseItems; +export default parseItems; diff --git a/topics/functional/01-state/04-practice-2/01-parse-items/solution/parseItems.js b/topics/functional/01-state/04-practice-2/01-parse-items/solution/parseItems.js index d40d6275e..b6ddb067d 100644 --- a/topics/functional/01-state/04-practice-2/01-parse-items/solution/parseItems.js +++ b/topics/functional/01-state/04-practice-2/01-parse-items/solution/parseItems.js @@ -1,3 +1,3 @@ const parseItems = items => items.map(item => parseInt(item)).sort(); -module.exports = parseItems; +export default parseItems; diff --git a/topics/functional/01-state/04-practice-2/01-parse-items/test/parseItems.spec.js b/topics/functional/01-state/04-practice-2/01-parse-items/test/parseItems.spec.js index e164680a7..7e7737b6a 100644 --- a/topics/functional/01-state/04-practice-2/01-parse-items/test/parseItems.spec.js +++ b/topics/functional/01-state/04-practice-2/01-parse-items/test/parseItems.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/parseItems'); +import { assert } from 'chai'; +import Submission from '../solution/parseItems.js'; describe('parseItems()', () => { @@ -8,22 +8,22 @@ describe('parseItems()', () => { const original = ['6', '3', '5', '2', '4']; const parsed = Submission(original); - Assert.notDeepEqual(original, parsed); - Assert.notEqual(original, parsed); + assert.notDeepEqual(original, parsed); + assert.notEqual(original, parsed); }); it('debería retornar un arreglo de números', () => { - Submission(['6', '3', '5', '2', '4']).forEach(Assert.isNumber); + Submission(['6', '3', '5', '2', '4']).forEach(assert.isNumber); }); it('debería retornar un arreglo ordenado', () => { - Assert.deepEqual(Submission(['6', '3', '5', '2', '4']), [2, 3, 4, 5, 6]); + assert.deepEqual(Submission(['6', '3', '5', '2', '4']), [2, 3, 4, 5, 6]); }); it('no debería mutar arreglo de entrada', () => { const original = ['6', '3', '5', '2', '4']; const parsed = Submission(original); - Assert.deepEqual(original, ['6', '3', '5', '2', '4']); + assert.deepEqual(original, ['6', '3', '5', '2', '4']); }); }); diff --git a/topics/functional/03-hof/02-practice/01-repeat/boilerplate/repeat.js b/topics/functional/03-hof/02-practice/01-repeat/boilerplate/repeat.js index 91b7ee821..aae39566c 100644 --- a/topics/functional/03-hof/02-practice/01-repeat/boilerplate/repeat.js +++ b/topics/functional/03-hof/02-practice/01-repeat/boilerplate/repeat.js @@ -3,4 +3,4 @@ function repeat(operation, num) { } // No borres la línea de abajo -module.exports = repeat; +export default repeat; diff --git a/topics/functional/03-hof/02-practice/01-repeat/solution/repeat.js b/topics/functional/03-hof/02-practice/01-repeat/solution/repeat.js index 12b68d099..1174f5f45 100644 --- a/topics/functional/03-hof/02-practice/01-repeat/solution/repeat.js +++ b/topics/functional/03-hof/02-practice/01-repeat/solution/repeat.js @@ -7,4 +7,4 @@ function repeat(operation, num) { } // No borres la línea de abajo -module.exports = repeat; +export default repeat; diff --git a/topics/functional/03-hof/02-practice/01-repeat/test/repeat.spec.js b/topics/functional/03-hof/02-practice/01-repeat/test/repeat.spec.js index db858c48b..7599eb3fd 100644 --- a/topics/functional/03-hof/02-practice/01-repeat/test/repeat.spec.js +++ b/topics/functional/03-hof/02-practice/01-repeat/test/repeat.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/repeat'); +import { assert } from 'chai'; +import Submission from '../solution/repeat.js'; describe('repeat()', () => { @@ -8,26 +8,26 @@ describe('repeat()', () => { let calls = 0; const fn = () => calls++; Submission(fn, 5); - Assert.equal(calls, 5); + assert.equal(calls, 5); }); it('debería invocar la función 8 veces cuando n es 8', () => { let calls = 0; const fn = () => calls++; Submission(fn, 8); - Assert.equal(calls, 8); + assert.equal(calls, 8); }); it('no debería invocar la función cuando n es 0', () => { let calls = 0; const fn = () => calls++; Submission(fn, 0); - Assert.equal(calls, 0); + assert.equal(calls, 0); }); it('debería retornar undefined', () => { const fn = () => true; - Assert.equal(Submission(fn, 5), undefined); + assert.equal(Submission(fn, 5), undefined); }); }); diff --git a/topics/functional/03-hof/04-practice-2/01-bound-logger/boilerplate/boundLogger.js b/topics/functional/03-hof/04-practice-2/01-bound-logger/boilerplate/boundLogger.js index 5dd619191..e05a1bb87 100644 --- a/topics/functional/03-hof/04-practice-2/01-bound-logger/boilerplate/boundLogger.js +++ b/topics/functional/03-hof/04-practice-2/01-bound-logger/boilerplate/boundLogger.js @@ -1,3 +1,3 @@ -exports.log = null; +export const log = null; -exports.logger = null; +export const logger = null; diff --git a/topics/functional/03-hof/04-practice-2/01-bound-logger/solution/boundLogger.js b/topics/functional/03-hof/04-practice-2/01-bound-logger/solution/boundLogger.js index 1e384ac77..b0a21d79b 100644 --- a/topics/functional/03-hof/04-practice-2/01-bound-logger/solution/boundLogger.js +++ b/topics/functional/03-hof/04-practice-2/01-bound-logger/solution/boundLogger.js @@ -1,3 +1,3 @@ -exports.log = (...args) => args.join(' '); +export const log = (...args) => args.join(' '); -exports.logger = namespace => exports.log.bind(null, namespace); +export const logger = namespace => log.bind(null, namespace); diff --git a/topics/functional/03-hof/04-practice-2/01-bound-logger/test/boundLogger.spec.js b/topics/functional/03-hof/04-practice-2/01-bound-logger/test/boundLogger.spec.js index ae354fcf1..de2c0fda5 100644 --- a/topics/functional/03-hof/04-practice-2/01-bound-logger/test/boundLogger.spec.js +++ b/topics/functional/03-hof/04-practice-2/01-bound-logger/test/boundLogger.spec.js @@ -1,13 +1,13 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/boundLogger'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import * as Submission from '../solution/boundLogger.js'; describe('with bind', () => { it('debería exportar log() y logger()', () => { - Assert.equal(typeof Submission.log, 'function'); - Assert.equal(typeof Submission.logger, 'function'); + assert.equal(typeof Submission.log, 'function'); + assert.equal(typeof Submission.logger, 'function'); }); describe('log()', () => { @@ -19,7 +19,7 @@ describe('with bind', () => { [['foo', 'bar', 'baz', 1, 2, 3], 'foo bar baz 1 2 3'], ].forEach(pair => { it(`debería retornar "${pair[1]}" para [${pair[0]}]`, () => { - Assert.equal(Submission.log.apply(null, pair[0]), pair[1]); + assert.equal(Submission.log.apply(null, pair[0]), pair[1]); }); }); @@ -29,12 +29,12 @@ describe('with bind', () => { it('debería combinar namespace + 1 string', () => { const info = Submission.logger('INFO:'); - Assert.equal(info('this is an info message'), 'INFO: this is an info message'); + assert.equal(info('this is an info message'), 'INFO: this is an info message'); }); it('debería combinar namespace + 2 strings', () => { const warn = Submission.logger('WARN:'); - Assert.equal( + assert.equal( warn('this is a warning message', 'with more info'), 'WARN: this is a warning message with more info' ); @@ -43,9 +43,9 @@ describe('with bind', () => { it('debería usar Function.prototype.bind', () => { const spy = Sinon.spy(Function.prototype, 'bind'); Submission.logger('ERROR:')('foo'); - Assert.equal(spy.callCount, 1); - Assert.equal(spy.args[0][0], null); - Assert.equal(spy.args[0][1], 'ERROR:'); + assert.equal(spy.callCount, 1); + assert.equal(spy.args[0][0], null); + assert.equal(spy.args[0][1], 'ERROR:'); spy.restore(); }); diff --git a/topics/functional/03-hof/04-practice-2/02-logger/boilerplate/logger.js b/topics/functional/03-hof/04-practice-2/02-logger/boilerplate/logger.js index 0399ff354..62c759c08 100644 --- a/topics/functional/03-hof/04-practice-2/02-logger/boilerplate/logger.js +++ b/topics/functional/03-hof/04-practice-2/02-logger/boilerplate/logger.js @@ -1,3 +1,3 @@ const logger = null; -module.exports = logger; +export default logger; diff --git a/topics/functional/03-hof/04-practice-2/02-logger/solution/logger.js b/topics/functional/03-hof/04-practice-2/02-logger/solution/logger.js index 4a1d075f3..a72026571 100644 --- a/topics/functional/03-hof/04-practice-2/02-logger/solution/logger.js +++ b/topics/functional/03-hof/04-practice-2/02-logger/solution/logger.js @@ -1,3 +1,3 @@ const logger = namespace => (...args) => `${namespace} ${args.join(' ')}`; -module.exports = logger; +export default logger; diff --git a/topics/functional/03-hof/04-practice-2/02-logger/test/logger.spec.js b/topics/functional/03-hof/04-practice-2/02-logger/test/logger.spec.js index 80fa6888d..81cb1a266 100644 --- a/topics/functional/03-hof/04-practice-2/02-logger/test/logger.spec.js +++ b/topics/functional/03-hof/04-practice-2/02-logger/test/logger.spec.js @@ -1,22 +1,22 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/logger'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/logger.js'; describe('logger()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería combinar namespace + 1 string', () => { const info = Submission('INFO:'); - Assert.equal(info('this is an info message'), 'INFO: this is an info message'); + assert.equal(info('this is an info message'), 'INFO: this is an info message'); }); it('debería combinar namespace + 2 strings', () => { const warn = Submission('WARN:'); - Assert.equal( + assert.equal( warn('this is a warning message', 'with more info'), 'WARN: this is a warning message with more info' ); @@ -25,7 +25,7 @@ describe('logger()', () => { it('no debería usar Function.prototype.bind', () => { const spy = Sinon.spy(Function.prototype, 'bind'); Submission('ERROR:')('foo'); - Assert.equal(spy.callCount, 0); + assert.equal(spy.callCount, 0); spy.restore(); }); diff --git a/topics/functional/03-hof/06-practice-3/01-curry-n/boilerplate/curryN.js b/topics/functional/03-hof/06-practice-3/01-curry-n/boilerplate/curryN.js index efb8f966f..cbbb90616 100644 --- a/topics/functional/03-hof/06-practice-3/01-curry-n/boilerplate/curryN.js +++ b/topics/functional/03-hof/06-practice-3/01-curry-n/boilerplate/curryN.js @@ -2,4 +2,4 @@ function curryN(fn, n) { // La solución vá aquí, } -module.exports = curryN +export default curryN; diff --git a/topics/functional/03-hof/06-practice-3/01-curry-n/solution/curryN.js b/topics/functional/03-hof/06-practice-3/01-curry-n/solution/curryN.js index 98caefb2d..e1d0719e2 100644 --- a/topics/functional/03-hof/06-practice-3/01-curry-n/solution/curryN.js +++ b/topics/functional/03-hof/06-practice-3/01-curry-n/solution/curryN.js @@ -6,4 +6,4 @@ function curryN(fn, n) { } } -module.exports = curryN +export default curryN diff --git a/topics/functional/03-hof/06-practice-3/01-curry-n/test/curryN.spec.js b/topics/functional/03-hof/06-practice-3/01-curry-n/test/curryN.spec.js index 5734c5728..74fd627ee 100644 --- a/topics/functional/03-hof/06-practice-3/01-curry-n/test/curryN.spec.js +++ b/topics/functional/03-hof/06-practice-3/01-curry-n/test/curryN.spec.js @@ -1,12 +1,12 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/curryN'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/curryN.js'; describe('curryN()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería crear cadena de funciones hasta haber agotado todos los argumentos', () => { @@ -18,15 +18,15 @@ describe('curryN()', () => { const curryB = curryC(1); const curryA = curryB(2); - Assert.equal(curryA(3), 6); - Assert.equal(curryA(10), 13); + assert.equal(curryA(3), 6); + assert.equal(curryA(10), 13); - Assert.equal(Submission(add3)(1)(2)(3), 6); + assert.equal(Submission(add3)(1)(2)(3), 6); }); it('no debería usar bucles for/while', () => { const fnBody = Submission.toString(); - Assert.equal(/(for|while)\s*\(/g.test(fnBody), false); + assert.equal(/(for|while)\s*\(/g.test(fnBody), false); }); it('no debería usar forEach', () => { @@ -36,8 +36,8 @@ describe('curryN()', () => { const spy = Sinon.spy(Array.prototype, 'forEach'); - Assert.equal(Submission(add3)(1)(2)(3), 6); - Assert.equal(spy.callCount, 0); + assert.equal(Submission(add3)(1)(2)(3), 6); + assert.equal(spy.callCount, 0); spy.restore(); }); diff --git a/topics/functional/05-flow-control/02-practice/01-apply-discount/boilerplate/applyDiscount.js b/topics/functional/05-flow-control/02-practice/01-apply-discount/boilerplate/applyDiscount.js index 11e463351..acd5492ea 100644 --- a/topics/functional/05-flow-control/02-practice/01-apply-discount/boilerplate/applyDiscount.js +++ b/topics/functional/05-flow-control/02-practice/01-apply-discount/boilerplate/applyDiscount.js @@ -6,4 +6,4 @@ const applyDiscount = (cart, discount) => { return cart; }; -module.exports = applyDiscount; +export default applyDiscount; diff --git a/topics/functional/05-flow-control/02-practice/01-apply-discount/solution/applyDiscount.js b/topics/functional/05-flow-control/02-practice/01-apply-discount/solution/applyDiscount.js index fcff99c5e..a98119257 100644 --- a/topics/functional/05-flow-control/02-practice/01-apply-discount/solution/applyDiscount.js +++ b/topics/functional/05-flow-control/02-practice/01-apply-discount/solution/applyDiscount.js @@ -11,4 +11,4 @@ const applyDiscount = (cart, discount) => (!cart.length) ? [{...cart[0], price: cart[0].price * (1 - discount) }] .concat(applyDiscount(cart.slice(1), discount)); -module.exports = applyDiscount; +export default applyDiscount; diff --git a/topics/functional/05-flow-control/02-practice/01-apply-discount/test/applyDiscount.spec.js b/topics/functional/05-flow-control/02-practice/01-apply-discount/test/applyDiscount.spec.js index e30ed06a7..7642c4711 100644 --- a/topics/functional/05-flow-control/02-practice/01-apply-discount/test/applyDiscount.spec.js +++ b/topics/functional/05-flow-control/02-practice/01-apply-discount/test/applyDiscount.spec.js @@ -1,18 +1,18 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/applyDiscount'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/applyDiscount.js'; describe('applyDiscount()', () => { it('debería de retornar una array nuevo en vez de mutar el array de entrada', () => { const cart = [{ price: 1 }, { price: 2 }, { price: 3 }]; - Assert.notEqual(Submission(cart, .2), cart); + assert.notEqual(Submission(cart, .2), cart); }); it('debería aplicar descuento esperado', () => { const cart = [{ price: 1 }, { price: 2 }, { price: 3 }]; - Assert.deepEqual( + assert.deepEqual( Submission(cart, .2), [{ price: 0.8 }, { price: 1.6 }, { price: 2.4000000000000004 }] ); @@ -22,14 +22,14 @@ describe('applyDiscount()', () => { const fnBody = Function.prototype.toString.call(Submission); // strip comments from source code const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); - Assert.equal(/(applyDiscount|module\.exports)\(/.test(strippedFnBody), true); + assert.equal(/(applyDiscount|module\.exports)\(/.test(strippedFnBody), true); }); it('no debería usar for o while', () => { const fnBody = Function.prototype.toString.call(Submission); // strip comments from source code const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); - Assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); + assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); }); it('no debería usar Array#map, Array#forEach o Array#reduce', () => { @@ -38,13 +38,13 @@ describe('applyDiscount()', () => { const forEachSpy = Sinon.spy(Array.prototype, 'forEach'); const reduceSpy = Sinon.spy(Array.prototype, 'reduce'); const result = Submission(cart, .2); - Assert.equal(result.length, 3); - Assert.equal(result[0].price, 0.8); - Assert.equal(result[1].price, 1.6); - Assert.equal(result[2].price, 2.4000000000000004); - Assert.equal(mapSpy.callCount, 0); - Assert.equal(forEachSpy.callCount, 0); - Assert.equal(reduceSpy.callCount, 0); + assert.equal(result.length, 3); + assert.equal(result[0].price, 0.8); + assert.equal(result[1].price, 1.6); + assert.equal(result[2].price, 2.4000000000000004); + assert.equal(mapSpy.callCount, 0); + assert.equal(forEachSpy.callCount, 0); + assert.equal(reduceSpy.callCount, 0); mapSpy.restore(); forEachSpy.restore(); reduceSpy.restore(); diff --git a/topics/functional/05-flow-control/02-practice/02-reduce/boilerplate/reduce.js b/topics/functional/05-flow-control/02-practice/02-reduce/boilerplate/reduce.js index 97964a673..713ab22f4 100644 --- a/topics/functional/05-flow-control/02-practice/02-reduce/boilerplate/reduce.js +++ b/topics/functional/05-flow-control/02-practice/02-reduce/boilerplate/reduce.js @@ -2,4 +2,4 @@ function reduce(arr, fn, initial) { // TU SOLUCIÓN AQUÍ } -module.exports = reduce; +export default reduce; diff --git a/topics/functional/05-flow-control/02-practice/02-reduce/solution/reduce.js b/topics/functional/05-flow-control/02-practice/02-reduce/solution/reduce.js index a98d64300..fa230d1c4 100644 --- a/topics/functional/05-flow-control/02-practice/02-reduce/solution/reduce.js +++ b/topics/functional/05-flow-control/02-practice/02-reduce/solution/reduce.js @@ -7,4 +7,4 @@ function reduce(arr, fn, initial) { })(0, initial); // IIFE. kick off recursion with initial values } -module.exports = reduce; +export default reduce; diff --git a/topics/functional/05-flow-control/02-practice/02-reduce/test/reduce.spec.js b/topics/functional/05-flow-control/02-practice/02-reduce/test/reduce.spec.js index 9d9dd5080..de232f282 100644 --- a/topics/functional/05-flow-control/02-practice/02-reduce/test/reduce.spec.js +++ b/topics/functional/05-flow-control/02-practice/02-reduce/test/reduce.spec.js @@ -1,22 +1,22 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/reduce'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/reduce.js'; describe('reduce()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería comportarse como reduce con array de números y valor inicial numérico', () => { - Assert.equal(Submission([1, 2, 3], (prev, curr, index, arr) => { + assert.equal(Submission([1, 2, 3], (prev, curr, index, arr) => { return prev + curr; }, 0), 6); }); it('debería comportarse como reduce con array de strings y valor inicial objeto', () => { - Assert.deepEqual(Submission(['foo', 'bar', 'foo', 'baz', 'foo'], (memo, curr) => { + assert.deepEqual(Submission(['foo', 'bar', 'foo', 'baz', 'foo'], (memo, curr) => { memo[curr] = (memo[curr]) ? memo[curr] + 1 : 1; return memo; }, {}), { foo: 3, bar: 1, baz: 1 }); @@ -27,15 +27,15 @@ describe('reduce()', () => { // // strip comments from source code // const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); // console.log(strippedFnBody); - // Assert.equal(/(reduce|module\.exports)\(/.test(strippedFnBody), true); + // assert.equal(/(reduce|module\.exports)\(/.test(strippedFnBody), true); // }); it('no debería usar for, while no Array#forEach', () => { const fnBody = Function.prototype.toString.call(Submission); // strip comments from source code const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); - Assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); - Assert.equal(/\.forEach\(/g.test(strippedFnBody), false); + assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); + assert.equal(/\.forEach\(/g.test(strippedFnBody), false); }); it('no debería usar Array#map o Array#reduce', () => { @@ -43,12 +43,12 @@ describe('reduce()', () => { const mapSpy = Sinon.spy(Array.prototype, 'map'); // const forEachSpy = Sinon.spy(Array.prototype, 'forEach'); const reduceSpy = Sinon.spy(Array.prototype, 'reduce'); - Assert.equal(Submission([1, 2, 3], (prev, curr, index, arr) => { + assert.equal(Submission([1, 2, 3], (prev, curr, index, arr) => { return prev + curr; }, 0), 6); - Assert.equal(mapSpy.callCount, 0); - // Assert.equal(forEachSpy.callCount, 0); - Assert.equal(reduceSpy.callCount, 0); + assert.equal(mapSpy.callCount, 0); + // assert.equal(forEachSpy.callCount, 0); + assert.equal(reduceSpy.callCount, 0); mapSpy.restore(); // forEachSpy.restore(); reduceSpy.restore(); diff --git a/topics/functional/05-flow-control/02-practice/03-get-dependencies/boilerplate/getDependencies.js b/topics/functional/05-flow-control/02-practice/03-get-dependencies/boilerplate/getDependencies.js index dec72074c..eb207433d 100644 --- a/topics/functional/05-flow-control/02-practice/03-get-dependencies/boilerplate/getDependencies.js +++ b/topics/functional/05-flow-control/02-practice/03-get-dependencies/boilerplate/getDependencies.js @@ -5,4 +5,4 @@ function getDependencies(tree) { // o no! Hay muchas maneras de hacer funcionar la recursividad. } -module.exports = getDependencies; +export default getDependencies; diff --git a/topics/functional/05-flow-control/02-practice/03-get-dependencies/solution/getDependencies.js b/topics/functional/05-flow-control/02-practice/03-get-dependencies/solution/getDependencies.js index d4167dace..2380f36ad 100644 --- a/topics/functional/05-flow-control/02-practice/03-get-dependencies/solution/getDependencies.js +++ b/topics/functional/05-flow-control/02-practice/03-get-dependencies/solution/getDependencies.js @@ -9,4 +9,4 @@ function getDependencies(mod, result) { return result.sort(); } -module.exports = getDependencies; +export default getDependencies; diff --git a/topics/functional/05-flow-control/02-practice/03-get-dependencies/test/getDependencies.spec.js b/topics/functional/05-flow-control/02-practice/03-get-dependencies/test/getDependencies.spec.js index d1d986f22..57ca40dcc 100644 --- a/topics/functional/05-flow-control/02-practice/03-get-dependencies/test/getDependencies.spec.js +++ b/topics/functional/05-flow-control/02-practice/03-get-dependencies/test/getDependencies.spec.js @@ -1,19 +1,19 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/getDependencies'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/getDependencies.js'; describe('getDependencies()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('no debería usar for o while', () => { const fnBody = Function.prototype.toString.call(Submission); // strip comments from source code const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); - Assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); + assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); }); it('debería usar Object.keys() en cada invación', () => { @@ -35,7 +35,7 @@ describe('getDependencies()', () => { } } }); - Assert.equal(spy.callCount, 4); + assert.equal(spy.callCount, 4); spy.restore(); }); @@ -57,7 +57,7 @@ describe('getDependencies()', () => { } } }; - Assert.deepEqual( + assert.deepEqual( Submission(loremIpsum), ['inflection@1.2.6', 'optimist@0.3.7', 'wordwrap@0.0.2'] ); diff --git a/topics/functional/05-flow-control/04-practice-2/01-load-users/boilerplate/loadUsers.js b/topics/functional/05-flow-control/04-practice-2/01-load-users/boilerplate/loadUsers.js index 649a330e7..2260b2e06 100644 --- a/topics/functional/05-flow-control/04-practice-2/01-load-users/boilerplate/loadUsers.js +++ b/topics/functional/05-flow-control/04-practice-2/01-load-users/boilerplate/loadUsers.js @@ -6,4 +6,4 @@ const loadUsers = (userIds, load, done) => { return users; } -module.exports = loadUsers; +export default loadUsers; diff --git a/topics/functional/05-flow-control/04-practice-2/01-load-users/solution/loadUsers.js b/topics/functional/05-flow-control/04-practice-2/01-load-users/solution/loadUsers.js index ac4d30267..1c10556cb 100644 --- a/topics/functional/05-flow-control/04-practice-2/01-load-users/solution/loadUsers.js +++ b/topics/functional/05-flow-control/04-practice-2/01-load-users/solution/loadUsers.js @@ -11,4 +11,4 @@ const loadUsers = (userIds, load, done) => { }); }; -module.exports = loadUsers; +export default loadUsers; diff --git a/topics/functional/05-flow-control/04-practice-2/01-load-users/test/loadUsers.spec.js b/topics/functional/05-flow-control/04-practice-2/01-load-users/test/loadUsers.spec.js index 23721d1ff..a3000650c 100644 --- a/topics/functional/05-flow-control/04-practice-2/01-load-users/test/loadUsers.spec.js +++ b/topics/functional/05-flow-control/04-practice-2/01-load-users/test/loadUsers.spec.js @@ -1,19 +1,19 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/loadUsers'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/loadUsers.js'; describe('loadUsers()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('no debería usar for o while', () => { const fnBody = Function.prototype.toString.call(Submission); // strip comments from source code const strippedFnBody = fnBody.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1'); - Assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); + assert.equal(/(for|while)\s*\(/g.test(strippedFnBody), false); }); it('debería mantener el orden de userIds en los resultados', (done) => { @@ -22,7 +22,7 @@ describe('loadUsers()', () => { setTimeout(() => cb && cb({ id: id, name: 'Lorem ipsum' }), 100 / ++count); Submission([1, 2, 3], load, (users) => { - Assert.deepEqual(users, [ + assert.deepEqual(users, [ { id: 1, name: 'Lorem ipsum' }, { id: 2, name: 'Lorem ipsum' }, { id: 3, name: 'Lorem ipsum' } @@ -37,7 +37,7 @@ describe('loadUsers()', () => { const start = Date.now(); Submission([3, 2, 1], load, (users) => { - Assert.ok((Date.now() - start) < 150); + assert.ok((Date.now() - start) < 150); done(); }); }); @@ -47,7 +47,7 @@ describe('loadUsers()', () => { setTimeout(() => cb && cb({ id: id, name: 'Lorem ipsum' }), 100); Submission([1, 2, 3], load, (users) => { - Assert.deepEqual(users, [ + assert.deepEqual(users, [ { id: 1, name: 'Lorem ipsum' }, { id: 2, name: 'Lorem ipsum' }, { id: 3, name: 'Lorem ipsum' } diff --git a/topics/javascript/01-basics/06-exercises/01-coin-convert/boilerplate/coinConvert.js b/topics/javascript/01-basics/06-exercises/01-coin-convert/boilerplate/coinConvert.js index 5d8a4b071..18ad94ae1 100644 --- a/topics/javascript/01-basics/06-exercises/01-coin-convert/boilerplate/coinConvert.js +++ b/topics/javascript/01-basics/06-exercises/01-coin-convert/boilerplate/coinConvert.js @@ -6,4 +6,4 @@ const coinConvert = (dollars) => { return [soles, pesosMexicanos, pesosChilenos]; }; -module.exports = coinConvert; +export default coinConvert; diff --git a/topics/javascript/01-basics/06-exercises/01-coin-convert/solution/coinConvert.js b/topics/javascript/01-basics/06-exercises/01-coin-convert/solution/coinConvert.js index 993ae68e3..6dd3fe413 100644 --- a/topics/javascript/01-basics/06-exercises/01-coin-convert/solution/coinConvert.js +++ b/topics/javascript/01-basics/06-exercises/01-coin-convert/solution/coinConvert.js @@ -6,4 +6,4 @@ const coinConvert = (dollars) => { return [soles, pesosMexicanos, pesosChilenos]; }; -module.exports = coinConvert; +export default coinConvert; diff --git a/topics/javascript/01-basics/06-exercises/01-coin-convert/test/coinConvert.spec.js b/topics/javascript/01-basics/06-exercises/01-coin-convert/test/coinConvert.spec.js index 8d5351c72..2be67fe17 100644 --- a/topics/javascript/01-basics/06-exercises/01-coin-convert/test/coinConvert.spec.js +++ b/topics/javascript/01-basics/06-exercises/01-coin-convert/test/coinConvert.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const coinConvert = require('../solution/coinConvert'); +import { assert } from 'chai'; +import coinConvert from '../solution/coinConvert.js'; describe('coinConvert()', () => { it('debería retornar [162.5, 900, 33000], para $50', () => { @@ -7,7 +7,7 @@ describe('coinConvert()', () => { const soles = dollars * 3.25; const pesosMx = dollars * 18; const pesosCl = dollars * 660; - Assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); + assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); }); it('debería retornar [325, 1800, 66000], para $100', () => { @@ -15,7 +15,7 @@ describe('coinConvert()', () => { const soles = dollars * 3.25; const pesosMx = dollars * 18; const pesosCl = dollars * 660; - Assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); + assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); }); it('debería retornar [243.75, 1350, 49500], para $85', () => { @@ -23,6 +23,6 @@ describe('coinConvert()', () => { const soles = dollars * 3.25; const pesosMx = dollars * 18; const pesosCl = dollars * 660; - Assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); + assert.deepEqual(coinConvert(dollars), [soles, pesosMx, pesosCl]); }); }); diff --git a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/boilerplate/restaurantBill.js b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/boilerplate/restaurantBill.js index 94fae7aa4..01bb58386 100644 --- a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/boilerplate/restaurantBill.js +++ b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/boilerplate/restaurantBill.js @@ -6,4 +6,4 @@ const restaurantBill = (bill) => { return /* ??? */ }; -module.exports = restaurantBill; +export default restaurantBill; diff --git a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/solution/restaurantBill.js b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/solution/restaurantBill.js index e60ef0c04..8ee715c50 100644 --- a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/solution/restaurantBill.js +++ b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/solution/restaurantBill.js @@ -6,4 +6,4 @@ const restaurantBill = (bill) => { return `$${total / 5}`; }; -module.exports = restaurantBill; +export default restaurantBill; diff --git a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/test/restaurantBill.spec.js b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/test/restaurantBill.spec.js index 919418c5f..a5a2f2f03 100644 --- a/topics/javascript/01-basics/06-exercises/02-restaurant-bill/test/restaurantBill.spec.js +++ b/topics/javascript/01-basics/06-exercises/02-restaurant-bill/test/restaurantBill.spec.js @@ -1,25 +1,25 @@ -const Assert = require('chai').assert; -const restaurantBill = require('../solution/restaurantBill'); +import { assert } from 'chai'; +import restaurantBill from '../solution/restaurantBill.js'; describe('restaurantBill()', () => { it('debería regresar $11, para 50', () => { const preTaxAmount = 50; const tax = preTaxAmount * 0.1; const total = `$${(preTaxAmount + tax) / 5}`; - Assert.deepEqual(restaurantBill(preTaxAmount), total); + assert.deepEqual(restaurantBill(preTaxAmount), total); }); it('debería regresar $22, para 100', () => { const preTaxAmount = 100; const tax = preTaxAmount * 0.1; const total = `$${(preTaxAmount + tax) / 5}`; - Assert.deepEqual(restaurantBill(preTaxAmount), total); + assert.deepEqual(restaurantBill(preTaxAmount), total); }); it('debería regresar $18.7, para 85', () => { const preTaxAmount = 85; const tax = preTaxAmount * 0.1; const total = `$${(preTaxAmount + tax) / 5}`; - Assert.deepEqual(restaurantBill(preTaxAmount), total); + assert.deepEqual(restaurantBill(preTaxAmount), total); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/boilerplate/powerOfTwo.js b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/boilerplate/powerOfTwo.js index 6bd598704..480b3c508 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/boilerplate/powerOfTwo.js +++ b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/boilerplate/powerOfTwo.js @@ -2,4 +2,4 @@ const powerOfTwo = (number) => { }; -module.exports = powerOfTwo; +export default powerOfTwo; diff --git a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/solution/powerOfTwo.js b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/solution/powerOfTwo.js index 8fb46f0bf..ff786f455 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/solution/powerOfTwo.js +++ b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/solution/powerOfTwo.js @@ -9,4 +9,4 @@ const powerOfTwo = (number) => { return result; }; -module.exports = powerOfTwo; +export default powerOfTwo; diff --git a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/test/powerOfTwo.spec.js b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/test/powerOfTwo.spec.js index 5171ddbff..a05f2e631 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/test/powerOfTwo.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/01-power-of-two/test/powerOfTwo.spec.js @@ -1,19 +1,19 @@ -const Assert = require('chai').assert; -const powerOfTwo = require('../solution/powerOfTwo'); +import { assert } from 'chai'; +import powerOfTwo from '../solution/powerOfTwo.js'; describe('powerOfTwo()', () => { it('debería regresar la potencia de 2 elevado al número ingresado cuando es positivo', () => { const output = powerOfTwo(10); - Assert.deepEqual(output, 1024); + assert.deepEqual(output, 1024); }); it('debería regresar 1 cuando el número ingresado es 0', () => { const output = powerOfTwo(0); - Assert.deepEqual(output, 1); + assert.deepEqual(output, 1); }); it('debería regresar 1 cuando el número ingresado es negativo', () => { const output = powerOfTwo(-5); - Assert.deepEqual(output, 1); + assert.deepEqual(output, 1); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/boilerplate/reverse.js b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/boilerplate/reverse.js index e2a99aa73..1c66a405d 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/boilerplate/reverse.js +++ b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/boilerplate/reverse.js @@ -2,4 +2,4 @@ const reverse = (array) => { }; -module.exports = reverse; +export default reverse; diff --git a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/solution/reverse.js b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/solution/reverse.js index 5b08d2459..68e97e918 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/solution/reverse.js +++ b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/solution/reverse.js @@ -8,4 +8,4 @@ const reverse = (array) => { return result; }; -module.exports = reverse; +export default reverse; diff --git a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/test/reverse.spec.js b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/test/reverse.spec.js index e16c4dd0a..e1ba448ed 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/02-reverse/test/reverse.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/02-reverse/test/reverse.spec.js @@ -1,24 +1,24 @@ -const Assert = require('chai').assert; -const reverse = require('../solution/reverse'); +import { assert } from 'chai'; +import reverse from '../solution/reverse.js'; describe('reverse()', () => { it('debería regresar el arreglo invertido cuando es un arreglo de números', () => { const output = reverse([1, 2, 3, 4]); - Assert.deepEqual(output, [4, 3, 2, 1]); + assert.deepEqual(output, [4, 3, 2, 1]); }); it('debería regresar el arreglo invertido cuando es un arreglo de caracteres', () => { const output = reverse(['j', 'a', 'v', 'a', 's', 'c', 'r', 'i', 'p', 't']); - Assert.deepEqual(output, ['t', 'p', 'i', 'r', 'c', 's', 'a', 'v', 'a', 'j']); + assert.deepEqual(output, ['t', 'p', 'i', 'r', 'c', 's', 'a', 'v', 'a', 'j']); }); it('debería regresar el arreglo invertido cuando es un arreglo de objetos', () => { const output = reverse([{ country: 'Chile' }, { country: 'México' }, { country: 'Perú' }]); - Assert.deepEqual(output, [{ country: 'Perú' }, { country: 'México' }, { country: 'Chile' }]); + assert.deepEqual(output, [{ country: 'Perú' }, { country: 'México' }, { country: 'Chile' }]); }); it('debería regresar el arreglo vacío cuando es un arreglo vacío', () => { const output = reverse([]); - Assert.deepEqual(output, []); + assert.deepEqual(output, []); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/boilerplate/countVowels.js b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/boilerplate/countVowels.js index 8de6f92c8..1d70d02c3 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/boilerplate/countVowels.js +++ b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/boilerplate/countVowels.js @@ -3,4 +3,4 @@ const countVowels = (str) => { }; -module.exports = countVowels; +export default countVowels; diff --git a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/solution/countVowels.js b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/solution/countVowels.js index 3c770a2c9..d50b59ca3 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/solution/countVowels.js +++ b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/solution/countVowels.js @@ -14,4 +14,4 @@ const countVowels = (str) => { return counter; }; -module.exports = countVowels; +export default countVowels; diff --git a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/test/countVowels.spec.js b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/test/countVowels.spec.js index 294d94b4b..4cf900730 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/test/countVowels.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/03-count-vowels/test/countVowels.spec.js @@ -1,14 +1,14 @@ -const Assert = require('chai').assert; -const countVowels = require('../solution/countVowels'); +import { assert } from 'chai'; +import countVowels from '../solution/countVowels.js'; describe('countVowels(string)', () => { it('debería retornar cuantas vocales hay en un string', () => { - Assert.deepEqual(countVowels('murcielago'), 5); - Assert.deepEqual(countVowels('sol'), 1); - Assert.deepEqual(countVowels('abecedario'), 6); + assert.deepEqual(countVowels('murcielago'), 5); + assert.deepEqual(countVowels('sol'), 1); + assert.deepEqual(countVowels('abecedario'), 6); }); it('debería retornar 0 si el string está vacío', () => { - Assert.deepEqual(countVowels(''), 0); + assert.deepEqual(countVowels(''), 0); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/boilerplate/evenOrOdd.js b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/boilerplate/evenOrOdd.js index 33c4d0c21..913de2601 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/boilerplate/evenOrOdd.js +++ b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/boilerplate/evenOrOdd.js @@ -2,4 +2,4 @@ const evenOrOdd = (n) => { }; -module.exports = evenOrOdd; +export default evenOrOdd; diff --git a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/solution/evenOrOdd.js b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/solution/evenOrOdd.js index c8c76e8ab..ff38e0d0d 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/solution/evenOrOdd.js +++ b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/solution/evenOrOdd.js @@ -1 +1 @@ -module.exports = n => ((n % 2 === 0) ? 0 : 1); +export default n => ((n % 2 === 0) ? 0 : 1); diff --git a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/test/evenOrOdd.spec.js b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/test/evenOrOdd.spec.js index 53010c4b1..a85c81186 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/test/evenOrOdd.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/04-even-or-odd/test/evenOrOdd.spec.js @@ -1,11 +1,11 @@ -const Assert = require('chai').assert; -const evenOrOdd = require('../solution/evenOrOdd'); +import { assert } from 'chai'; +import evenOrOdd from '../solution/evenOrOdd.js'; describe('evenOrOdd(n)', () => { it('debería retornar si el número que se pasa como parámetro es par o impar', () => { - Assert.deepEqual(evenOrOdd(5), 1); - Assert.deepEqual(evenOrOdd(66), 0); - Assert.deepEqual(evenOrOdd(20), 0); - Assert.deepEqual(evenOrOdd(35), 1); + assert.deepEqual(evenOrOdd(5), 1); + assert.deepEqual(evenOrOdd(66), 0); + assert.deepEqual(evenOrOdd(20), 0); + assert.deepEqual(evenOrOdd(35), 1); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/05-max/boilerplate/max.js b/topics/javascript/02-flow-control/06-code-challenges/05-max/boilerplate/max.js index a735b1ae8..0823a7112 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/05-max/boilerplate/max.js +++ b/topics/javascript/02-flow-control/06-code-challenges/05-max/boilerplate/max.js @@ -3,4 +3,4 @@ const max = (A, B, C) => { }; -module.exports = max; +export default max; diff --git a/topics/javascript/02-flow-control/06-code-challenges/05-max/solution/max.js b/topics/javascript/02-flow-control/06-code-challenges/05-max/solution/max.js index f121d1245..2cfdac7d5 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/05-max/solution/max.js +++ b/topics/javascript/02-flow-control/06-code-challenges/05-max/solution/max.js @@ -16,4 +16,4 @@ const max = (A, B, C) => { return maximo; }; -module.exports = max; +export default max; diff --git a/topics/javascript/02-flow-control/06-code-challenges/05-max/test/max.spec.js b/topics/javascript/02-flow-control/06-code-challenges/05-max/test/max.spec.js index 3678da00b..e01d4743a 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/05-max/test/max.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/05-max/test/max.spec.js @@ -1,10 +1,10 @@ -const Assert = require('chai').assert; -const max = require('../solution/max'); +import { assert } from 'chai'; +import max from '../solution/max.js'; describe('max()', () => { it('debería retornar el número que sea mayor', () => { - Assert.deepEqual(max(5, 6, 7), 7); - Assert.deepEqual(max(66, 4, 6), 66); - Assert.deepEqual(max(20, 25, 10), 25); + assert.deepEqual(max(5, 6, 7), 7); + assert.deepEqual(max(66, 4, 6), 66); + assert.deepEqual(max(20, 25, 10), 25); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/boilerplate/isPrime.js b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/boilerplate/isPrime.js index 3441aa862..cf1131dfa 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/boilerplate/isPrime.js +++ b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/boilerplate/isPrime.js @@ -3,4 +3,4 @@ const isPrime = (n) => { }; -module.exports = isPrime; +export default isPrime; diff --git a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/solution/isPrime.js b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/solution/isPrime.js index ca0397b01..809800fe3 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/solution/isPrime.js +++ b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/solution/isPrime.js @@ -13,4 +13,4 @@ const isPrime = (n) => { }; -module.exports = isPrime; +export default isPrime; diff --git a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/test/isPrime.spec.js b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/test/isPrime.spec.js index 04a709936..42cb61e07 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/test/isPrime.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/06-is-prime/test/isPrime.spec.js @@ -1,11 +1,11 @@ -const Assert = require('chai').assert; -const isPrime = require('../solution/isPrime'); +import { assert } from 'chai'; +import isPrime from '../solution/isPrime.js'; describe('isPrime(n)', () => { it('debería retornar si el número que se da como parámetro es primo o no', () => { - Assert.deepEqual(isPrime(5), true); - Assert.deepEqual(isPrime(6), false); - Assert.deepEqual(isPrime(23), true); - Assert.deepEqual(isPrime(35), false); + assert.deepEqual(isPrime(5), true); + assert.deepEqual(isPrime(6), false); + assert.deepEqual(isPrime(23), true); + assert.deepEqual(isPrime(35), false); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/boilerplate/canDriveAndVote.js b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/boilerplate/canDriveAndVote.js index 960a4991f..cd923dd97 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/boilerplate/canDriveAndVote.js +++ b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/boilerplate/canDriveAndVote.js @@ -3,4 +3,4 @@ const canDriveAndVote = (edad) => { }; -module.exports = canDriveAndVote; +export default canDriveAndVote; diff --git a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/solution/canDriveAndVote.js b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/solution/canDriveAndVote.js index 91789f06a..42a2bdd66 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/solution/canDriveAndVote.js +++ b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/solution/canDriveAndVote.js @@ -6,4 +6,4 @@ const canDriveAndVote = (edad) => { return false; }; -module.exports = canDriveAndVote; +export default canDriveAndVote; diff --git a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/test/canDriveAndVote.spec.js b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/test/canDriveAndVote.spec.js index 11ab7c7a7..0c60018f5 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/test/canDriveAndVote.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/07-can-drive-and-vote/test/canDriveAndVote.spec.js @@ -1,10 +1,10 @@ -const Assert = require('chai').assert; -const canDriveAndVote = require('../solution/canDriveAndVote'); +import { assert } from 'chai'; +import canDriveAndVote from '../solution/canDriveAndVote.js'; describe('canDriveAndVote()', () => { it('debería retornar true si cumple con ambas condiciones (16 años o más y 18 años o más), en caso contrario retornar false', () => { - Assert.deepEqual(canDriveAndVote(25), true); - Assert.deepEqual(canDriveAndVote(12), false); - Assert.deepEqual(canDriveAndVote(16), false); + assert.deepEqual(canDriveAndVote(25), true); + assert.deepEqual(canDriveAndVote(12), false); + assert.deepEqual(canDriveAndVote(16), false); }); }); diff --git a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/boilerplate/areOdd.js b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/boilerplate/areOdd.js index c5eeb1524..cf9fca2c9 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/boilerplate/areOdd.js +++ b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/boilerplate/areOdd.js @@ -3,4 +3,4 @@ const areOdd = (n, m) => { }; -module.exports = areOdd; +export default areOdd; diff --git a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/solution/areOdd.js b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/solution/areOdd.js index 6e0f69f9d..fd1a751c2 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/solution/areOdd.js +++ b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/solution/areOdd.js @@ -6,4 +6,4 @@ const areOdd = (n, m) => { return false; }; -module.exports = areOdd; +export default areOdd; diff --git a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/test/areOdd.spec.js b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/test/areOdd.spec.js index 0f6feb7a3..493f5c2e5 100644 --- a/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/test/areOdd.spec.js +++ b/topics/javascript/02-flow-control/06-code-challenges/08-are-odd/test/areOdd.spec.js @@ -1,11 +1,11 @@ -const Assert = require('chai').assert; -const areOdd = require('../solution/areOdd'); +import { assert } from 'chai'; +import areOdd from '../solution/areOdd.js'; describe('areOdd()', () => { it('debería retornar true si ambos números son pares', () => { - Assert.deepEqual(areOdd(22, 10), true); - Assert.deepEqual(areOdd(12, 5), false); - Assert.deepEqual(areOdd(16, 8), true); - Assert.deepEqual(areOdd(33, 15), false); + assert.deepEqual(areOdd(22, 10), true); + assert.deepEqual(areOdd(12, 5), false); + assert.deepEqual(areOdd(16, 8), true); + assert.deepEqual(areOdd(33, 15), false); }); }); diff --git a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/boilerplate/computeAverageLengthOfWords.js b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/boilerplate/computeAverageLengthOfWords.js index 0fed52a59..fc12976c9 100644 --- a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/boilerplate/computeAverageLengthOfWords.js +++ b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/boilerplate/computeAverageLengthOfWords.js @@ -3,4 +3,4 @@ const computeAverageLengthOfWords = (word1, word2) => { }; -module.exports = computeAverageLengthOfWords; +export default computeAverageLengthOfWords; diff --git a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/solution/computeAverageLengthOfWords.js b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/solution/computeAverageLengthOfWords.js index 9656d3e23..d5199bfe0 100644 --- a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/solution/computeAverageLengthOfWords.js +++ b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/solution/computeAverageLengthOfWords.js @@ -1,3 +1,3 @@ const computeAverageLengthOfWords = (word1, word2) => (word1.length + word2.length) / 2; -module.exports = computeAverageLengthOfWords; +export default computeAverageLengthOfWords; diff --git a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/test/computeAverageLengthOfWords.spec.js b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/test/computeAverageLengthOfWords.spec.js index 4f81425c4..88f896883 100644 --- a/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/test/computeAverageLengthOfWords.spec.js +++ b/topics/javascript/04-arrays/06-practice/01-compute-average-length-of-words/test/computeAverageLengthOfWords.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const computeAverageLengthOfWords = require('../solution/computeAverageLengthOfWords'); +import { assert } from 'chai'; +import computeAverageLengthOfWords from '../solution/computeAverageLengthOfWords.js'; describe('computeAverageLengthOfWords()', () => { it('debería regresar 4, para ("A", "kamnjhs")', () => { diff --git a/topics/javascript/04-arrays/06-practice/02-get-nth-element/boilerplate/getNthElement.js b/topics/javascript/04-arrays/06-practice/02-get-nth-element/boilerplate/getNthElement.js index 5c6f18dbc..886206928 100644 --- a/topics/javascript/04-arrays/06-practice/02-get-nth-element/boilerplate/getNthElement.js +++ b/topics/javascript/04-arrays/06-practice/02-get-nth-element/boilerplate/getNthElement.js @@ -2,4 +2,4 @@ const getNthElement = (array, n) => { // your code here }; -module.exports = getNthElement; +export default getNthElement; diff --git a/topics/javascript/04-arrays/06-practice/02-get-nth-element/solution/getNthElement.js b/topics/javascript/04-arrays/06-practice/02-get-nth-element/solution/getNthElement.js index b932c268c..1ddb949f2 100644 --- a/topics/javascript/04-arrays/06-practice/02-get-nth-element/solution/getNthElement.js +++ b/topics/javascript/04-arrays/06-practice/02-get-nth-element/solution/getNthElement.js @@ -1,3 +1,3 @@ const getNthElement = (array, n) => array[n]; -module.exports = getNthElement; +export default getNthElement; diff --git a/topics/javascript/04-arrays/06-practice/02-get-nth-element/test/getNthElement.spec.js b/topics/javascript/04-arrays/06-practice/02-get-nth-element/test/getNthElement.spec.js index 233e1f70d..03e1640d8 100644 --- a/topics/javascript/04-arrays/06-practice/02-get-nth-element/test/getNthElement.spec.js +++ b/topics/javascript/04-arrays/06-practice/02-get-nth-element/test/getNthElement.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getNthElement = require('../solution/getNthElement'); +import { assert } from 'chai'; +import getNthElement from '../solution/getNthElement.js'; describe('getNthElement()', () => { it('debería regresar undefined, para array vacío', () => { diff --git a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/boilerplate/convertDoubleSpaceToSingle.js b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/boilerplate/convertDoubleSpaceToSingle.js index 08a97e050..3eae51c18 100644 --- a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/boilerplate/convertDoubleSpaceToSingle.js +++ b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/boilerplate/convertDoubleSpaceToSingle.js @@ -2,4 +2,4 @@ const convertDoubleSpaceToSingle = (str) => { // your code here }; -module.exports = convertDoubleSpaceToSingle; +export default convertDoubleSpaceToSingle; diff --git a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/solution/convertDoubleSpaceToSingle.js b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/solution/convertDoubleSpaceToSingle.js index 91e172762..3712928ed 100644 --- a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/solution/convertDoubleSpaceToSingle.js +++ b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/solution/convertDoubleSpaceToSingle.js @@ -1,3 +1,3 @@ const convertDoubleSpaceToSingle = str => str.split(' ').join(' '); -module.exports = convertDoubleSpaceToSingle; +export default convertDoubleSpaceToSingle; diff --git a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/test/convertDoubleSpaceToSingle.spec.js b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/test/convertDoubleSpaceToSingle.spec.js index 897ca9b5a..924a54fbf 100644 --- a/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/test/convertDoubleSpaceToSingle.spec.js +++ b/topics/javascript/04-arrays/06-practice/03-convert-double-space-to-single/test/convertDoubleSpaceToSingle.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const convertDoubleSpaceToSingle = require('../solution/convertDoubleSpaceToSingle'); +import { assert } from 'chai'; +import convertDoubleSpaceToSingle from '../solution/convertDoubleSpaceToSingle.js'; describe('convertDoubleSpaceToSingle()', () => { it("debería regresar '', para string vacío", () => { diff --git a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/boilerplate/areValidCredentials.js b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/boilerplate/areValidCredentials.js index 4a9606a6e..be38cf853 100644 --- a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/boilerplate/areValidCredentials.js +++ b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/boilerplate/areValidCredentials.js @@ -2,4 +2,4 @@ const areValidCredentials = (name, password) => { // your code here }; -module.exports = areValidCredentials; +export default areValidCredentials; diff --git a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/solution/areValidCredentials.js b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/solution/areValidCredentials.js index f7f381889..0e99dd897 100644 --- a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/solution/areValidCredentials.js +++ b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/solution/areValidCredentials.js @@ -1,3 +1,3 @@ const areValidCredentials = (name, password) => (name.length > 3 && password.length >= 8); -module.exports = areValidCredentials; +export default areValidCredentials; diff --git a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/test/areValidCredentials.spec.js b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/test/areValidCredentials.spec.js index 4fd2b8b94..64713d8c9 100644 --- a/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/test/areValidCredentials.spec.js +++ b/topics/javascript/04-arrays/06-practice/04-are-valid-credentials/test/areValidCredentials.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const areValidCredentials = require('../solution/areValidCredentials'); +import { assert } from 'chai'; +import areValidCredentials from '../solution/areValidCredentials.js'; describe('areValidCredentials()', () => { it('debería regresar true cuando las credenciales son válidas', () => { diff --git a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/boilerplate/findPairForSum.js b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/boilerplate/findPairForSum.js index 586b629ef..7696aaa8a 100644 --- a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/boilerplate/findPairForSum.js +++ b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/boilerplate/findPairForSum.js @@ -2,4 +2,4 @@ const findPairForSum = (array, number) => { }; -module.exports = findPairForSum; +export default findPairForSum; diff --git a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/solution/findPairForSum.js b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/solution/findPairForSum.js index 977772048..1b57bc613 100644 --- a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/solution/findPairForSum.js +++ b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/solution/findPairForSum.js @@ -10,4 +10,4 @@ const findPairForSum = (array, number) => { return []; }; -module.exports = findPairForSum; +export default findPairForSum; diff --git a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/test/findPairForSum.spec.js b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/test/findPairForSum.spec.js index 88d05b690..6f3cb22d6 100644 --- a/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/test/findPairForSum.spec.js +++ b/topics/javascript/04-arrays/06-practice/05-find-pair-for-sum/test/findPairForSum.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const findPairForSum = require('../solution/findPairForSum'); +import { assert } from 'chai'; +import findPairForSum from '../solution/findPairForSum.js'; describe('findPairForSum()', () => { it('debería regresar [0, 1], para ([0, 8, 1, 7, 19, 12, 4], 1)', () => { diff --git a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/boilerplate/filterOddElements.js b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/boilerplate/filterOddElements.js index 3fb53bdb4..df9526fa7 100644 --- a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/boilerplate/filterOddElements.js +++ b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/boilerplate/filterOddElements.js @@ -2,4 +2,4 @@ const filterOddElements = (arr) => { // your code here }; -module.exports = filterOddElements; +export default filterOddElements; diff --git a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/solution/filterOddElements.js b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/solution/filterOddElements.js index d5351eae3..4b1f08a71 100644 --- a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/solution/filterOddElements.js +++ b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/solution/filterOddElements.js @@ -10,4 +10,4 @@ const filterOddElements = (arr) => { return ret; }; -module.exports = filterOddElements; +export default filterOddElements; diff --git a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/test/filterOddElements.spec.js b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/test/filterOddElements.spec.js index 9abb80879..a45b66ea9 100644 --- a/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/test/filterOddElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/06-filter-odd-elements/test/filterOddElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const filterOddElements = require('../solution/filterOddElements'); +import { assert } from 'chai'; +import filterOddElements from '../solution/filterOddElements.js'; describe('filterOddElements()', () => { it('Prueba: ([2, 4, 6, 8, 10]) => []', () => { diff --git a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/boilerplate/findShortestWordAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/boilerplate/findShortestWordAmongMixedElements.js index 60c93b5b3..fbd47a7d1 100644 --- a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/boilerplate/findShortestWordAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/boilerplate/findShortestWordAmongMixedElements.js @@ -2,4 +2,4 @@ const findShortestWordAmongMixedElements = (arr) => { // your code here }; -module.exports = findShortestWordAmongMixedElements; +export default findShortestWordAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/solution/findShortestWordAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/solution/findShortestWordAmongMixedElements.js index 168b5cd89..b2f2f3506 100644 --- a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/solution/findShortestWordAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/solution/findShortestWordAmongMixedElements.js @@ -22,4 +22,4 @@ const findShortestWordAmongMixedElements = (arr) => { return arr[index]; }; -module.exports = findShortestWordAmongMixedElements; +export default findShortestWordAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/test/findShortestWordAmongMixedElements.spec.js b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/test/findShortestWordAmongMixedElements.spec.js index 0aaf31350..7d48d73d1 100644 --- a/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/test/findShortestWordAmongMixedElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/07-find-shortest-word-among-mixed-elements/test/findShortestWordAmongMixedElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const findShortestWordAmongMixedElements = require('../solution/findShortestWordAmongMixedElements'); +import { assert } from 'chai'; +import findShortestWordAmongMixedElements from '../solution/findShortestWordAmongMixedElements.js'; describe('findShortestWordAmongMixedElements()', () => { it("debería regresar '', para ([3, 4, 5])", () => { diff --git a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/boilerplate/findSmallestNumberAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/boilerplate/findSmallestNumberAmongMixedElements.js index 7d96131f2..d9d0b7b70 100644 --- a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/boilerplate/findSmallestNumberAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/boilerplate/findSmallestNumberAmongMixedElements.js @@ -2,4 +2,4 @@ const findSmallestNumberAmongMixedElements = (arr) => { // your code here }; -module.exports = findSmallestNumberAmongMixedElements; +export default findSmallestNumberAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/solution/findSmallestNumberAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/solution/findSmallestNumberAmongMixedElements.js index f6e21ee8d..b077b62e1 100644 --- a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/solution/findSmallestNumberAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/solution/findSmallestNumberAmongMixedElements.js @@ -22,4 +22,4 @@ const findSmallestNumberAmongMixedElements = (arr) => { return arr[index]; }; -module.exports = findSmallestNumberAmongMixedElements; +export default findSmallestNumberAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/test/findSmallestNumberAmongMixedElements.spec.js b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/test/findSmallestNumberAmongMixedElements.spec.js index 3cb48712d..813c2b6ce 100644 --- a/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/test/findSmallestNumberAmongMixedElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/08-find-smallest-number-among-mixed-elements/test/findSmallestNumberAmongMixedElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const findSmallestNumberAmongMixedElements = require('../solution/findSmallestNumberAmongMixedElements'); +import { assert } from 'chai'; +import findSmallestNumberAmongMixedElements from '../solution/findSmallestNumberAmongMixedElements.js'; describe('findSmallestNumberAmongMixedElements()', () => { it("debería regresar 0, para (['cat', 'is', 'cute', 'as', 'fuck'])", () => { diff --git a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/boilerplate/getLongestWordOfMixedElements.js b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/boilerplate/getLongestWordOfMixedElements.js index 87b95b5b3..ef1e2a9bd 100644 --- a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/boilerplate/getLongestWordOfMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/boilerplate/getLongestWordOfMixedElements.js @@ -2,4 +2,4 @@ const getLongestWordOfMixedElements = (arr) => { // your code here }; -module.exports = getLongestWordOfMixedElements; +export default getLongestWordOfMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/solution/getLongestWordOfMixedElements.js b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/solution/getLongestWordOfMixedElements.js index 9ceb7eaa4..1d4f6dff7 100644 --- a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/solution/getLongestWordOfMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/solution/getLongestWordOfMixedElements.js @@ -22,4 +22,4 @@ const getLongestWordOfMixedElements = (arr) => { return arr[index]; }; -module.exports = getLongestWordOfMixedElements; +export default getLongestWordOfMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/test/getLongestWordOfMixedElements.spec.js b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/test/getLongestWordOfMixedElements.spec.js index fcca27e7f..b9fc94c9f 100644 --- a/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/test/getLongestWordOfMixedElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/09-get-longest-word-of-mixed-elements/test/getLongestWordOfMixedElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getLongestWordOfMixedElements = require('../solution/getLongestWordOfMixedElements'); +import { assert } from 'chai'; +import getLongestWordOfMixedElements from '../solution/getLongestWordOfMixedElements.js'; describe('getLongestWordOfMixedElements()', () => { it("debería regresar '', para ([3, 4, 5, 6, 7])", () => { diff --git a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/boilerplate/getLargestNumberAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/boilerplate/getLargestNumberAmongMixedElements.js index 40e0eb9dc..9ae993428 100644 --- a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/boilerplate/getLargestNumberAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/boilerplate/getLargestNumberAmongMixedElements.js @@ -2,4 +2,4 @@ const getLargestNumberAmongMixedElements = (arr) => { // your code here }; -module.exports = getLargestNumberAmongMixedElements; +export default getLargestNumberAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/solution/getLargestNumberAmongMixedElements.js b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/solution/getLargestNumberAmongMixedElements.js index e864e0efc..dec86cc98 100644 --- a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/solution/getLargestNumberAmongMixedElements.js +++ b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/solution/getLargestNumberAmongMixedElements.js @@ -22,4 +22,4 @@ const getLargestNumberAmongMixedElements = (arr) => { return arr[index]; }; -module.exports = getLargestNumberAmongMixedElements; +export default getLargestNumberAmongMixedElements; diff --git a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/test/getLargestNumberAmongMixedElements.spec.js b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/test/getLargestNumberAmongMixedElements.spec.js index 48ceef863..77020afb7 100644 --- a/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/test/getLargestNumberAmongMixedElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/10-get-largest-number-among-mixed-elements/test/getLargestNumberAmongMixedElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getLargestNumberAmongMixedElements = require('../solution/getLargestNumberAmongMixedElements'); +import { assert } from 'chai'; +import getLargestNumberAmongMixedElements from '../solution/getLargestNumberAmongMixedElements.js'; describe('getLargestNumberAmongMixedElements()', () => { it("debería regresar 0, para (['wat', 'no', true, true])", () => { diff --git a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/boilerplate/computeSumOfAllElements.js b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/boilerplate/computeSumOfAllElements.js index 3a4155d68..843645d00 100644 --- a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/boilerplate/computeSumOfAllElements.js +++ b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/boilerplate/computeSumOfAllElements.js @@ -2,4 +2,4 @@ const computeSumOfAllElements = (arr) => { // your code here }; -module.exports = computeSumOfAllElements; +export default computeSumOfAllElements; diff --git a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/solution/computeSumOfAllElements.js b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/solution/computeSumOfAllElements.js index 27a3c3104..87994b7b9 100644 --- a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/solution/computeSumOfAllElements.js +++ b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/solution/computeSumOfAllElements.js @@ -14,4 +14,4 @@ const computeSumOfAllElements = (arr) => { return sum; }; -module.exports = computeSumOfAllElements; +export default computeSumOfAllElements; diff --git a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/test/computeSumOfAllElements.spec.js b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/test/computeSumOfAllElements.spec.js index 21ceab893..de42251bf 100644 --- a/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/test/computeSumOfAllElements.spec.js +++ b/topics/javascript/04-arrays/06-practice/11-compute-sum-of-all-elements/test/computeSumOfAllElements.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const computeSumOfAllElements = require('../solution/computeSumOfAllElements'); +import { assert } from 'chai'; +import computeSumOfAllElements from '../solution/computeSumOfAllElements.js'; describe('computeSumOfAllElements()', () => { it('debería regresar 0, para ([1, 2, 3])', () => { diff --git a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/boilerplate/computeSumBetween.js b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/boilerplate/computeSumBetween.js index 1345dd00b..32b3732ee 100644 --- a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/boilerplate/computeSumBetween.js +++ b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/boilerplate/computeSumBetween.js @@ -2,4 +2,4 @@ const computeSumBetween = (num1, num2) => { // your code here }; -module.exports = computeSumBetween; +export default computeSumBetween; diff --git a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/solution/computeSumBetween.js b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/solution/computeSumBetween.js index 4ea6f7b70..0e547e6e0 100644 --- a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/solution/computeSumBetween.js +++ b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/solution/computeSumBetween.js @@ -8,4 +8,4 @@ const computeSumBetween = (num1, num2) => { return sum; }; -module.exports = computeSumBetween; +export default computeSumBetween; diff --git a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/test/computeSumBetween.spec.js b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/test/computeSumBetween.spec.js index 36cf79f8b..a2ebf4683 100644 --- a/topics/javascript/04-arrays/06-practice/12-compute-sum-between/test/computeSumBetween.spec.js +++ b/topics/javascript/04-arrays/06-practice/12-compute-sum-between/test/computeSumBetween.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const computeSumBetween = require('../solution/computeSumBetween'); +import { assert } from 'chai'; +import computeSumBetween from '../solution/computeSumBetween.js'; describe('computeSumBetween()', () => { it("debería regresar [{a: 1, b: 2, c: true}, {a: 10, b: 20, c: false}], para [[['a', 1], ['b', 2], ['c', true]],[['a', 10], ['b', 20], ['c', false]]]", () => { diff --git a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/boilerplate/getLongestOfThreeWords.js b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/boilerplate/getLongestOfThreeWords.js index 17d58b897..eb31adb59 100644 --- a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/boilerplate/getLongestOfThreeWords.js +++ b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/boilerplate/getLongestOfThreeWords.js @@ -2,4 +2,4 @@ const getLongestOfThreeWords = (word1, word2, word3) => { // your code here }; -module.exports = getLongestOfThreeWords; +export default getLongestOfThreeWords; diff --git a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/solution/getLongestOfThreeWords.js b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/solution/getLongestOfThreeWords.js index 488e87b6f..cea345f9c 100644 --- a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/solution/getLongestOfThreeWords.js +++ b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/solution/getLongestOfThreeWords.js @@ -12,4 +12,4 @@ const getLongestOfThreeWords = (word1, word2, word3) => { return strLong; }; -module.exports = getLongestOfThreeWords; +export default getLongestOfThreeWords; diff --git a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/test/getLongestOfThreeWords.spec.js b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/test/getLongestOfThreeWords.spec.js index c418867b9..a3ebc763c 100644 --- a/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/test/getLongestOfThreeWords.spec.js +++ b/topics/javascript/04-arrays/06-practice/13-get-longest-of-three-words/test/getLongestOfThreeWords.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getLongestOfThreeWords = require('../solution/getLongestOfThreeWords'); +import { assert } from 'chai'; +import getLongestOfThreeWords from '../solution/getLongestOfThreeWords.js'; describe('getLongestOfThreeWords()', () => { it("debería regresar 'these', para 'these', 'three', 'words'", () => { diff --git a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/boilerplate/findShortestOfThreeWords.js b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/boilerplate/findShortestOfThreeWords.js index 7db41e40a..9b1923841 100644 --- a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/boilerplate/findShortestOfThreeWords.js +++ b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/boilerplate/findShortestOfThreeWords.js @@ -2,4 +2,4 @@ const findShortestOfThreeWords = (word1, word2, word3) => { // your code here }; -module.exports = findShortestOfThreeWords; +export default findShortestOfThreeWords; diff --git a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/solution/findShortestOfThreeWords.js b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/solution/findShortestOfThreeWords.js index 44ac89399..b43d34e18 100644 --- a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/solution/findShortestOfThreeWords.js +++ b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/solution/findShortestOfThreeWords.js @@ -12,4 +12,4 @@ const findShortestOfThreeWords = (word1, word2, word3) => { return strShort; }; -module.exports = findShortestOfThreeWords; +export default findShortestOfThreeWords; diff --git a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/test/findShortestOfThreeWords.spec.js b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/test/findShortestOfThreeWords.spec.js index d9c9b4442..3d8c3802d 100644 --- a/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/test/findShortestOfThreeWords.spec.js +++ b/topics/javascript/04-arrays/06-practice/14-find-shortest-of-three-words/test/findShortestOfThreeWords.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const findShortestOfThreeWords = require('../solution/findShortestOfThreeWords'); +import { assert } from 'chai'; +import findShortestOfThreeWords from '../solution/findShortestOfThreeWords.js'; describe('findShortestOfThreeWords()', () => { it("debería regresar 'b', para 'yes', 'b', 'a', 'two', 'three', 'four'", () => { diff --git a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/boilerplate/calculateBillTotal.js b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/boilerplate/calculateBillTotal.js index 595a34220..a2b73611e 100644 --- a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/boilerplate/calculateBillTotal.js +++ b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/boilerplate/calculateBillTotal.js @@ -2,4 +2,4 @@ const calculateBillTotal = (preTaxAndTipAmount) => { // your code here }; -module.exports = calculateBillTotal; +export default calculateBillTotal; diff --git a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/solution/calculateBillTotal.js b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/solution/calculateBillTotal.js index 70aa48aca..d26d518a0 100644 --- a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/solution/calculateBillTotal.js +++ b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/solution/calculateBillTotal.js @@ -1 +1 @@ -module.exports = amount => amount + (amount * 0.095) + (amount * 0.15); +export default amount => amount + (amount * 0.095) + (amount * 0.15); diff --git a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/test/calculateBillTotal.spec.js b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/test/calculateBillTotal.spec.js index 71e8c004c..cf9f4e6ca 100644 --- a/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/test/calculateBillTotal.spec.js +++ b/topics/javascript/04-arrays/06-practice/15-calculate-bill-total/test/calculateBillTotal.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const calculateBillTotal = require('../solution/calculateBillTotal'); +import { assert } from 'chai'; +import calculateBillTotal from '../solution/calculateBillTotal.js'; describe('calculateBillTotal()', () => { it('debería regresar 62.25, para 50', () => { diff --git a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/boilerplate/convertScoreToGrade.js b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/boilerplate/convertScoreToGrade.js index 46c0f1f51..7633bb461 100644 --- a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/boilerplate/convertScoreToGrade.js +++ b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/boilerplate/convertScoreToGrade.js @@ -2,4 +2,4 @@ const convertScoreToGrade = (score) => { // your code here }; -module.exports = convertScoreToGrade; +export default convertScoreToGrade; diff --git a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/solution/convertScoreToGrade.js b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/solution/convertScoreToGrade.js index 2f509367d..94cc23809 100644 --- a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/solution/convertScoreToGrade.js +++ b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/solution/convertScoreToGrade.js @@ -24,4 +24,4 @@ const convertScoreToGrade = (score) => { return str; }; -module.exports = convertScoreToGrade; +export default convertScoreToGrade; diff --git a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/test/convertScoreToGrade.spec.js b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/test/convertScoreToGrade.spec.js index 83ade354e..36b55eb28 100644 --- a/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/test/convertScoreToGrade.spec.js +++ b/topics/javascript/04-arrays/06-practice/16-convert-score-to-grade/test/convertScoreToGrade.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const convertScoreToGrade = require('../solution/convertScoreToGrade'); +import { assert } from 'chai'; +import convertScoreToGrade from '../solution/convertScoreToGrade.js'; describe('convertScoreToGrade()', () => { it("debería regresar 'PUNTUACION INVALIDA', para 102", () => { diff --git a/topics/javascript/05-objects/06-practice/00-add-array-property/boilerplate/addArrayProperty.js b/topics/javascript/05-objects/06-practice/00-add-array-property/boilerplate/addArrayProperty.js index 181c44ddc..649d12783 100644 --- a/topics/javascript/05-objects/06-practice/00-add-array-property/boilerplate/addArrayProperty.js +++ b/topics/javascript/05-objects/06-practice/00-add-array-property/boilerplate/addArrayProperty.js @@ -2,4 +2,4 @@ const addArrayProperty = (obj, key, arr) => { // your code here }; -module.exports = addArrayProperty; +export default addArrayProperty; diff --git a/topics/javascript/05-objects/06-practice/00-add-array-property/solution/addArrayProperty.js b/topics/javascript/05-objects/06-practice/00-add-array-property/solution/addArrayProperty.js index a79d95e0d..ee822235c 100644 --- a/topics/javascript/05-objects/06-practice/00-add-array-property/solution/addArrayProperty.js +++ b/topics/javascript/05-objects/06-practice/00-add-array-property/solution/addArrayProperty.js @@ -1,4 +1,4 @@ const addArrayProperty = (obj, key, arr) => Object.assign(obj, { [key]: arr }); -module.exports = addArrayProperty; +export default addArrayProperty; diff --git a/topics/javascript/05-objects/06-practice/00-add-array-property/test/addArrayProperty.spec.js b/topics/javascript/05-objects/06-practice/00-add-array-property/test/addArrayProperty.spec.js index 053208c0e..f04377d14 100644 --- a/topics/javascript/05-objects/06-practice/00-add-array-property/test/addArrayProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/00-add-array-property/test/addArrayProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const addArrayProperty = require('../solution/addArrayProperty'); +import { assert } from 'chai'; +import addArrayProperty from '../solution/addArrayProperty.js'; describe('addArrayProperty()', () => { it('debería regresar [5, 8, 12], para addArrayProperty({}, "key", [5, 8, 12])', () => { diff --git a/topics/javascript/05-objects/06-practice/01-object-properties-counter/boilerplate/objectPropertiesCounter.js b/topics/javascript/05-objects/06-practice/01-object-properties-counter/boilerplate/objectPropertiesCounter.js index 087018096..71fd6bcb5 100644 --- a/topics/javascript/05-objects/06-practice/01-object-properties-counter/boilerplate/objectPropertiesCounter.js +++ b/topics/javascript/05-objects/06-practice/01-object-properties-counter/boilerplate/objectPropertiesCounter.js @@ -2,4 +2,4 @@ const objectPropertiesCounter = (obj) => { }; -module.exports = objectPropertiesCounter; +export default objectPropertiesCounter; diff --git a/topics/javascript/05-objects/06-practice/01-object-properties-counter/solution/objectPropertiesCounter.js b/topics/javascript/05-objects/06-practice/01-object-properties-counter/solution/objectPropertiesCounter.js index d3b0495d1..155494ad5 100644 --- a/topics/javascript/05-objects/06-practice/01-object-properties-counter/solution/objectPropertiesCounter.js +++ b/topics/javascript/05-objects/06-practice/01-object-properties-counter/solution/objectPropertiesCounter.js @@ -1,3 +1,3 @@ const objectPropertiesCounter = obj => Object.keys(obj).length; -module.exports = objectPropertiesCounter; +export default objectPropertiesCounter; diff --git a/topics/javascript/05-objects/06-practice/01-object-properties-counter/test/objectPropertiesCounter.spec.js b/topics/javascript/05-objects/06-practice/01-object-properties-counter/test/objectPropertiesCounter.spec.js index ba3d92463..d86df9c2a 100644 --- a/topics/javascript/05-objects/06-practice/01-object-properties-counter/test/objectPropertiesCounter.spec.js +++ b/topics/javascript/05-objects/06-practice/01-object-properties-counter/test/objectPropertiesCounter.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const objectPropertiesCounter = require('../solution/objectPropertiesCounter'); +import { assert } from 'chai'; +import objectPropertiesCounter from '../solution/objectPropertiesCounter.js'; describe('objectPropertiesCounter()', () => { it('debería regresar la cantidad de propiedades cuando es un objeto simple', () => { diff --git a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/boilerplate/removeStringValuesLongerThan.js b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/boilerplate/removeStringValuesLongerThan.js index 0c2ab384d..55ee22498 100644 --- a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/boilerplate/removeStringValuesLongerThan.js +++ b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/boilerplate/removeStringValuesLongerThan.js @@ -2,4 +2,4 @@ const removeStringValuesLongerThan = (num, obj) => { // your code here }; -module.exports = removeStringValuesLongerThan; +export default removeStringValuesLongerThan; diff --git a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/solution/removeStringValuesLongerThan.js b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/solution/removeStringValuesLongerThan.js index f184ea437..ef10b1ac6 100644 --- a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/solution/removeStringValuesLongerThan.js +++ b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/solution/removeStringValuesLongerThan.js @@ -8,4 +8,4 @@ const removeStringValuesLongerThan = (num, obj) => Object.keys(obj).reduce( ); -module.exports = removeStringValuesLongerThan; +export default removeStringValuesLongerThan; diff --git a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/test/removeStringValuesLongerThan.spec.js b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/test/removeStringValuesLongerThan.spec.js index 9d6a79ea1..a5c819ba3 100644 --- a/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/test/removeStringValuesLongerThan.spec.js +++ b/topics/javascript/05-objects/06-practice/02-remove-string-values-longer-than/test/removeStringValuesLongerThan.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const removeStringValuesLongerThan = require('../solution/removeStringValuesLongerThan'); +import { assert } from 'chai'; +import removeStringValuesLongerThan from '../solution/removeStringValuesLongerThan.js'; describe('removeStringValuesLongerThan()', () => { it('Prueba: key-value mayor a 1', () => { diff --git a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/boilerplate/getElementOfArrayProperty.js b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/boilerplate/getElementOfArrayProperty.js index 1f5b3111c..b21f649c5 100644 --- a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/boilerplate/getElementOfArrayProperty.js +++ b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/boilerplate/getElementOfArrayProperty.js @@ -2,4 +2,4 @@ const getElementOfArrayProperty = (obj, key, index) => { // your code here }; -module.exports = getElementOfArrayProperty; +export default getElementOfArrayProperty; diff --git a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/solution/getElementOfArrayProperty.js b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/solution/getElementOfArrayProperty.js index 0cdf4fc87..92dd19a39 100644 --- a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/solution/getElementOfArrayProperty.js +++ b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/solution/getElementOfArrayProperty.js @@ -14,4 +14,4 @@ const getElementOfArrayProperty = (obj, key, index) => { return obj[key][index]; }; -module.exports = getElementOfArrayProperty; +export default getElementOfArrayProperty; diff --git a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/test/getElementOfArrayProperty.spec.js b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/test/getElementOfArrayProperty.spec.js index 68f09093b..e5f16b8fd 100644 --- a/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/test/getElementOfArrayProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/03-get-element-of-array-property/test/getElementOfArrayProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getElementOfArrayProperty = require('../solution/getElementOfArrayProperty'); +import { assert } from 'chai'; +import getElementOfArrayProperty from '../solution/getElementOfArrayProperty.js'; describe('getElementOfArrayProperty()', () => { it("debería regresar undefined, para ({yey: [1, 3, 5, 7]}, 'key', 1)", () => { diff --git a/topics/javascript/05-objects/06-practice/04-greet-customer/boilerplate/greetCustomer.js b/topics/javascript/05-objects/06-practice/04-greet-customer/boilerplate/greetCustomer.js index 2a6093a64..4206bc79c 100644 --- a/topics/javascript/05-objects/06-practice/04-greet-customer/boilerplate/greetCustomer.js +++ b/topics/javascript/05-objects/06-practice/04-greet-customer/boilerplate/greetCustomer.js @@ -21,4 +21,4 @@ const greetCustomer = (firstName) => { return greeting; }; -module.exports = greetCustomer; +export default greetCustomer; diff --git a/topics/javascript/05-objects/06-practice/04-greet-customer/solution/greetCustomer.js b/topics/javascript/05-objects/06-practice/04-greet-customer/solution/greetCustomer.js index cae705535..1da29835c 100644 --- a/topics/javascript/05-objects/06-practice/04-greet-customer/solution/greetCustomer.js +++ b/topics/javascript/05-objects/06-practice/04-greet-customer/solution/greetCustomer.js @@ -29,4 +29,4 @@ const greetCustomer = (firstName) => { return undefined; }; -module.exports = greetCustomer; +export default greetCustomer; diff --git a/topics/javascript/05-objects/06-practice/04-greet-customer/test/greetCustomer.spec.js b/topics/javascript/05-objects/06-practice/04-greet-customer/test/greetCustomer.spec.js index 981a08012..2333e27c3 100644 --- a/topics/javascript/05-objects/06-practice/04-greet-customer/test/greetCustomer.spec.js +++ b/topics/javascript/05-objects/06-practice/04-greet-customer/test/greetCustomer.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const greetCustomer = require('../solution/greetCustomer'); +import { assert } from 'chai'; +import greetCustomer from '../solution/greetCustomer.js'; describe('greetCustomer()', () => { it("debería regresar 'Welcome back, Howard! So glad to see you again!', para ('Howard')", () => { diff --git a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/boilerplate/transformFirstAndLast.js b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/boilerplate/transformFirstAndLast.js index 2a65254a5..d8f8d1ec9 100644 --- a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/boilerplate/transformFirstAndLast.js +++ b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/boilerplate/transformFirstAndLast.js @@ -2,4 +2,4 @@ const transformFirstAndLast = (array) => { // your code here }; -module.exports = transformFirstAndLast; +export default transformFirstAndLast; diff --git a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/solution/transformFirstAndLast.js b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/solution/transformFirstAndLast.js index ca8b6cd89..f1de47c3c 100644 --- a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/solution/transformFirstAndLast.js +++ b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/solution/transformFirstAndLast.js @@ -6,4 +6,4 @@ const transformFirstAndLast = (array) => { return obj; }; -module.exports = transformFirstAndLast; +export default transformFirstAndLast; diff --git a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/test/transformFirstAndLast.spec.js b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/test/transformFirstAndLast.spec.js index 2a6f8f3a2..6b2bdbb29 100644 --- a/topics/javascript/05-objects/06-practice/05-transform-first-and-last/test/transformFirstAndLast.spec.js +++ b/topics/javascript/05-objects/06-practice/05-transform-first-and-last/test/transformFirstAndLast.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const transformFirstAndLast = require('../solution/transformFirstAndLast'); +import { assert } from 'chai'; +import transformFirstAndLast from '../solution/transformFirstAndLast.js'; describe('transformFirstAndLast()', () => { it("debería regresar { King : 'Freddie' }, para ['King', 'Kemal', 'Freddie']", () => { diff --git a/topics/javascript/05-objects/06-practice/06-get-all-keys/boilerplate/getAllKeys.js b/topics/javascript/05-objects/06-practice/06-get-all-keys/boilerplate/getAllKeys.js index 4e5f92309..c995a3936 100644 --- a/topics/javascript/05-objects/06-practice/06-get-all-keys/boilerplate/getAllKeys.js +++ b/topics/javascript/05-objects/06-practice/06-get-all-keys/boilerplate/getAllKeys.js @@ -2,4 +2,4 @@ const getAllKeys = (obj) => { // your code here }; -module.exports = getAllKeys; +export default getAllKeys; diff --git a/topics/javascript/05-objects/06-practice/06-get-all-keys/solution/getAllKeys.js b/topics/javascript/05-objects/06-practice/06-get-all-keys/solution/getAllKeys.js index e4fa058c9..53ab6c190 100644 --- a/topics/javascript/05-objects/06-practice/06-get-all-keys/solution/getAllKeys.js +++ b/topics/javascript/05-objects/06-practice/06-get-all-keys/solution/getAllKeys.js @@ -1,3 +1,3 @@ const getAllKeys = obj => Object.keys(obj); -module.exports = getAllKeys; +export default getAllKeys; diff --git a/topics/javascript/05-objects/06-practice/06-get-all-keys/test/getAllKeys.spec.js b/topics/javascript/05-objects/06-practice/06-get-all-keys/test/getAllKeys.spec.js index 36027dcf9..65a0bf637 100644 --- a/topics/javascript/05-objects/06-practice/06-get-all-keys/test/getAllKeys.spec.js +++ b/topics/javascript/05-objects/06-practice/06-get-all-keys/test/getAllKeys.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getAllKeys = require('../solution/getAllKeys'); +import { assert } from 'chai'; +import getAllKeys from '../solution/getAllKeys.js'; describe('getAllKeys()', () => { it("debería regresar ['tes', 'ini', 'berhasil'], para { tes : 'tes', ini : 'apa',berhasil : 10 }", () => { diff --git a/topics/javascript/05-objects/06-practice/07-from-list-to-object/boilerplate/fromListToObject.js b/topics/javascript/05-objects/06-practice/07-from-list-to-object/boilerplate/fromListToObject.js index 279cfd331..4b820f788 100644 --- a/topics/javascript/05-objects/06-practice/07-from-list-to-object/boilerplate/fromListToObject.js +++ b/topics/javascript/05-objects/06-practice/07-from-list-to-object/boilerplate/fromListToObject.js @@ -2,4 +2,4 @@ const fromListToObject = (array) => { // your code here }; -module.exports = fromListToObject; +export default fromListToObject; diff --git a/topics/javascript/05-objects/06-practice/07-from-list-to-object/solution/fromListToObject.js b/topics/javascript/05-objects/06-practice/07-from-list-to-object/solution/fromListToObject.js index 8befd310c..33c0416b2 100644 --- a/topics/javascript/05-objects/06-practice/07-from-list-to-object/solution/fromListToObject.js +++ b/topics/javascript/05-objects/06-practice/07-from-list-to-object/solution/fromListToObject.js @@ -9,4 +9,4 @@ const fromListToObject = (array) => { return obj; }; -module.exports = fromListToObject; +export default fromListToObject; diff --git a/topics/javascript/05-objects/06-practice/07-from-list-to-object/test/fromListToObject.spec.js b/topics/javascript/05-objects/06-practice/07-from-list-to-object/test/fromListToObject.spec.js index 4acad1a61..18f0b4c09 100644 --- a/topics/javascript/05-objects/06-practice/07-from-list-to-object/test/fromListToObject.spec.js +++ b/topics/javascript/05-objects/06-practice/07-from-list-to-object/test/fromListToObject.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const fromListToObject = require('../solution/fromListToObject'); +import { assert } from 'chai'; +import fromListToObject from '../solution/fromListToObject.js'; describe('fromListToObject()', () => { it("debería regresar { make: 'Ford', model: 'Mustang', year: 1964, quality: 'eeehhh' }, para [['make', 'Ford'], ['model', 'Mustang'], ['year', 1964], ['quality', 'eeehhh']]", () => { diff --git a/topics/javascript/05-objects/06-practice/08-list-all-values/boilerplate/listAllValues.js b/topics/javascript/05-objects/06-practice/08-list-all-values/boilerplate/listAllValues.js index df8886b6a..43aaaaa90 100644 --- a/topics/javascript/05-objects/06-practice/08-list-all-values/boilerplate/listAllValues.js +++ b/topics/javascript/05-objects/06-practice/08-list-all-values/boilerplate/listAllValues.js @@ -2,4 +2,4 @@ const listAllValues = (obj) => { // your code here }; -module.exports = listAllValues; +export default listAllValues; diff --git a/topics/javascript/05-objects/06-practice/08-list-all-values/solution/listAllValues.js b/topics/javascript/05-objects/06-practice/08-list-all-values/solution/listAllValues.js index c626afe10..9d82cd3ec 100644 --- a/topics/javascript/05-objects/06-practice/08-list-all-values/solution/listAllValues.js +++ b/topics/javascript/05-objects/06-practice/08-list-all-values/solution/listAllValues.js @@ -9,4 +9,4 @@ const listAllValues = (obj) => { return arr; }; -module.exports = listAllValues; +export default listAllValues; diff --git a/topics/javascript/05-objects/06-practice/08-list-all-values/test/listAllValues.spec.js b/topics/javascript/05-objects/06-practice/08-list-all-values/test/listAllValues.spec.js index 575c28974..6afd883c3 100644 --- a/topics/javascript/05-objects/06-practice/08-list-all-values/test/listAllValues.spec.js +++ b/topics/javascript/05-objects/06-practice/08-list-all-values/test/listAllValues.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const listAllValues = require('../solution/listAllValues'); +import { assert } from 'chai'; +import listAllValues from '../solution/listAllValues.js'; describe('listAllValues()', () => { it('debería regresar [1, 2, 3, false, false], para { a: 1, b: 2, c: 3, d: false, e: false }', () => { diff --git a/topics/javascript/05-objects/06-practice/09-transform-employee-data/boilerplate/transformEmployeeData.js b/topics/javascript/05-objects/06-practice/09-transform-employee-data/boilerplate/transformEmployeeData.js index de2232047..05802febd 100644 --- a/topics/javascript/05-objects/06-practice/09-transform-employee-data/boilerplate/transformEmployeeData.js +++ b/topics/javascript/05-objects/06-practice/09-transform-employee-data/boilerplate/transformEmployeeData.js @@ -2,4 +2,4 @@ const transformEmployeeData = (array) => { // your code here }; -module.exports = transformEmployeeData; +export default transformEmployeeData; diff --git a/topics/javascript/05-objects/06-practice/09-transform-employee-data/solution/transformEmployeeData.js b/topics/javascript/05-objects/06-practice/09-transform-employee-data/solution/transformEmployeeData.js index 2b22a5684..e336fe1a5 100644 --- a/topics/javascript/05-objects/06-practice/09-transform-employee-data/solution/transformEmployeeData.js +++ b/topics/javascript/05-objects/06-practice/09-transform-employee-data/solution/transformEmployeeData.js @@ -16,4 +16,4 @@ const transformEmployeeData = (array) => { return arrayMain; }; -module.exports = transformEmployeeData; +export default transformEmployeeData; diff --git a/topics/javascript/05-objects/06-practice/09-transform-employee-data/test/transformEmployeeData.spec.js b/topics/javascript/05-objects/06-practice/09-transform-employee-data/test/transformEmployeeData.spec.js index b371fc997..ab598435c 100644 --- a/topics/javascript/05-objects/06-practice/09-transform-employee-data/test/transformEmployeeData.spec.js +++ b/topics/javascript/05-objects/06-practice/09-transform-employee-data/test/transformEmployeeData.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const transformEmployeeData = require('../solution/transformEmployeeData'); +import { assert } from 'chai'; +import transformEmployeeData from '../solution/transformEmployeeData.js'; describe('transformEmployeeData()', () => { it("debería regresar [{a: 1, b: 2, c: true}, {a: 10, b: 20, c: false}], para [[['a', 1], ['b', 2], ['c', true]],[['a', 10], ['b', 20], ['c', false]]]", () => { diff --git a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/boilerplate/convertObjectToList.js b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/boilerplate/convertObjectToList.js index b9ddf8b12..a59a3ef03 100644 --- a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/boilerplate/convertObjectToList.js +++ b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/boilerplate/convertObjectToList.js @@ -2,4 +2,4 @@ const convertObjectToList = (obj) => { // your code here }; -module.exports = convertObjectToList; +export default convertObjectToList; diff --git a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/solution/convertObjectToList.js b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/solution/convertObjectToList.js index 9aca6c6b5..47e4bbb84 100644 --- a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/solution/convertObjectToList.js +++ b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/solution/convertObjectToList.js @@ -9,4 +9,4 @@ const convertObjectToList = (obj) => { return arr; }; -module.exports = convertObjectToList; +export default convertObjectToList; diff --git a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/test/convertObjectToList.spec.js b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/test/convertObjectToList.spec.js index 3dcb4a826..496fc50b7 100644 --- a/topics/javascript/05-objects/06-practice/10-convert-object-to-list/test/convertObjectToList.spec.js +++ b/topics/javascript/05-objects/06-practice/10-convert-object-to-list/test/convertObjectToList.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const convertObjectToList = require('../solution/convertObjectToList'); +import { assert } from 'chai'; +import convertObjectToList from '../solution/convertObjectToList.js'; describe('convertObjectToList()', () => { it("debería regresar [['a', 1], ['b', 'c'], ['d', true], ['e', 10]], para { a: 1, b: 'c', d: true, e: 10 }", () => { diff --git a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/boilerplate/getSumOfAllElementsAtProperty.js b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/boilerplate/getSumOfAllElementsAtProperty.js index 65bd26b2a..b49d00cec 100644 --- a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/boilerplate/getSumOfAllElementsAtProperty.js +++ b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/boilerplate/getSumOfAllElementsAtProperty.js @@ -2,4 +2,4 @@ const getSumOfAllElementsAtProperty = (obj, key) => { // your code here }; -module.exports = getSumOfAllElementsAtProperty; +export default getSumOfAllElementsAtProperty; diff --git a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/solution/getSumOfAllElementsAtProperty.js b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/solution/getSumOfAllElementsAtProperty.js index 75f62affd..cdce030b4 100644 --- a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/solution/getSumOfAllElementsAtProperty.js +++ b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/solution/getSumOfAllElementsAtProperty.js @@ -11,4 +11,4 @@ const getSumOfAllElementsAtProperty = (obj, key) => { return sum; }; -module.exports = getSumOfAllElementsAtProperty; +export default getSumOfAllElementsAtProperty; diff --git a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/test/getSumOfAllElementsAtProperty.spec.js b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/test/getSumOfAllElementsAtProperty.spec.js index dc648ed14..125a3121b 100644 --- a/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/test/getSumOfAllElementsAtProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/11-get-sum-of-all-elements-at-property/test/getSumOfAllElementsAtProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getSumOfAllElementsAtProperty = require('../solution/getSumOfAllElementsAtProperty'); +import { assert } from 'chai'; +import getSumOfAllElementsAtProperty from '../solution/getSumOfAllElementsAtProperty.js'; describe('getSumOfAllElementsAtProperty()', () => { it("debería regresar 0, para { key: Badddlyyyy } y 'key'", () => { diff --git a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/boilerplate/getProductOfAllElementsAtProperty.js b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/boilerplate/getProductOfAllElementsAtProperty.js index 198952c7e..f0267422a 100644 --- a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/boilerplate/getProductOfAllElementsAtProperty.js +++ b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/boilerplate/getProductOfAllElementsAtProperty.js @@ -2,4 +2,4 @@ const getProductOfAllElementsAtProperty = (obj, key) => { // your code here }; -module.exports = getProductOfAllElementsAtProperty; +export default getProductOfAllElementsAtProperty; diff --git a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/solution/getProductOfAllElementsAtProperty.js b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/solution/getProductOfAllElementsAtProperty.js index 976189505..024389423 100644 --- a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/solution/getProductOfAllElementsAtProperty.js +++ b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/solution/getProductOfAllElementsAtProperty.js @@ -11,4 +11,4 @@ const getProductOfAllElementsAtProperty = (obj, key) => { return product; }; -module.exports = getProductOfAllElementsAtProperty; +export default getProductOfAllElementsAtProperty; diff --git a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/test/getProductOfAllElementsAtProperty.spec.js b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/test/getProductOfAllElementsAtProperty.spec.js index 21ce9b607..fd5c771d5 100644 --- a/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/test/getProductOfAllElementsAtProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/12-get-product-of-all-elements-at-property/test/getProductOfAllElementsAtProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const getProductOfAllElementsAtProperty = require('../solution/getProductOfAllElementsAtProperty'); +import { assert } from 'chai'; +import getProductOfAllElementsAtProperty from '../solution/getProductOfAllElementsAtProperty.js'; describe('getProductOfAllElementsAtProperty()', () => { it("debería regresar 0, para { koy: [1, 2, 3] } y 'key'", () => { diff --git a/topics/javascript/05-objects/06-practice/13-add-object-property/boilerplate/addObjectProperty.js b/topics/javascript/05-objects/06-practice/13-add-object-property/boilerplate/addObjectProperty.js index 025e8889a..32f0b9d9d 100644 --- a/topics/javascript/05-objects/06-practice/13-add-object-property/boilerplate/addObjectProperty.js +++ b/topics/javascript/05-objects/06-practice/13-add-object-property/boilerplate/addObjectProperty.js @@ -2,4 +2,4 @@ const addObjectProperty = (obj1, key, obj2) => { // your code here }; -module.exports = addObjectProperty; +export default addObjectProperty; diff --git a/topics/javascript/05-objects/06-practice/13-add-object-property/solution/addObjectProperty.js b/topics/javascript/05-objects/06-practice/13-add-object-property/solution/addObjectProperty.js index c63284ff5..a6e616711 100644 --- a/topics/javascript/05-objects/06-practice/13-add-object-property/solution/addObjectProperty.js +++ b/topics/javascript/05-objects/06-practice/13-add-object-property/solution/addObjectProperty.js @@ -1,3 +1,3 @@ const addObjectProperty = (obj1, key, obj2) => Object.assign(obj1, { [key]: obj2 }); -module.exports = addObjectProperty; +export default addObjectProperty; diff --git a/topics/javascript/05-objects/06-practice/13-add-object-property/test/addObjectProperty.spec.js b/topics/javascript/05-objects/06-practice/13-add-object-property/test/addObjectProperty.spec.js index f8703a238..2def02e84 100644 --- a/topics/javascript/05-objects/06-practice/13-add-object-property/test/addObjectProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/13-add-object-property/test/addObjectProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const addObjectProperty = require('../solution/addObjectProperty'); +import { assert } from 'chai'; +import addObjectProperty from '../solution/addObjectProperty.js'; describe('addObjectProperty(obj1, key, obj2)', () => { it('debería asignar obj2 en obj1[key]', () => { diff --git a/topics/javascript/05-objects/06-practice/14-add-full-name-property/boilerplate/addFullNameProperty.js b/topics/javascript/05-objects/06-practice/14-add-full-name-property/boilerplate/addFullNameProperty.js index b14fd5da3..081e53f92 100644 --- a/topics/javascript/05-objects/06-practice/14-add-full-name-property/boilerplate/addFullNameProperty.js +++ b/topics/javascript/05-objects/06-practice/14-add-full-name-property/boilerplate/addFullNameProperty.js @@ -2,4 +2,4 @@ const addFullNameProperty = (obj) => { // your code here }; -module.exports = addFullNameProperty; +export default addFullNameProperty; diff --git a/topics/javascript/05-objects/06-practice/14-add-full-name-property/solution/addFullNameProperty.js b/topics/javascript/05-objects/06-practice/14-add-full-name-property/solution/addFullNameProperty.js index ca861ee8e..4e3b8845a 100644 --- a/topics/javascript/05-objects/06-practice/14-add-full-name-property/solution/addFullNameProperty.js +++ b/topics/javascript/05-objects/06-practice/14-add-full-name-property/solution/addFullNameProperty.js @@ -3,4 +3,4 @@ const addFullNameProperty = obj => ({ fullName: `${obj.firstName} ${obj.lastName}`, }); -module.exports = addFullNameProperty; +export default addFullNameProperty; diff --git a/topics/javascript/05-objects/06-practice/14-add-full-name-property/test/addFullNameProperty.spec.js b/topics/javascript/05-objects/06-practice/14-add-full-name-property/test/addFullNameProperty.spec.js index 6a629ca25..7b2b9c98b 100644 --- a/topics/javascript/05-objects/06-practice/14-add-full-name-property/test/addFullNameProperty.spec.js +++ b/topics/javascript/05-objects/06-practice/14-add-full-name-property/test/addFullNameProperty.spec.js @@ -1,5 +1,5 @@ -const { assert } = require('chai'); -const addFullNameProperty = require('../solution/addFullNameProperty'); +import { assert } from 'chai'; +import addFullNameProperty from '../solution/addFullNameProperty.js'; describe('addFullNameProperty()', () => { it('debería regresar "Kemal Mahmud", para {firstName: "Kemal", lastName: "Mahmud"}', () => { diff --git a/topics/javascript/06-strings/02-practice/01-currency-amount/boilerplate/currencyAmount.js b/topics/javascript/06-strings/02-practice/01-currency-amount/boilerplate/currencyAmount.js index da09c4430..49adeb335 100644 --- a/topics/javascript/06-strings/02-practice/01-currency-amount/boilerplate/currencyAmount.js +++ b/topics/javascript/06-strings/02-practice/01-currency-amount/boilerplate/currencyAmount.js @@ -2,4 +2,4 @@ const currencyAmount = (amounts) => { }; -module.exports = currencyAmount; +export default currencyAmount; diff --git a/topics/javascript/06-strings/02-practice/01-currency-amount/solution/currencyAmount.js b/topics/javascript/06-strings/02-practice/01-currency-amount/solution/currencyAmount.js index 6f403852f..1831db5e1 100644 --- a/topics/javascript/06-strings/02-practice/01-currency-amount/solution/currencyAmount.js +++ b/topics/javascript/06-strings/02-practice/01-currency-amount/solution/currencyAmount.js @@ -1,3 +1,3 @@ const currencyAmount = amounts => amounts.map(amount => Number(amount.replace(/(\$|S\/\.)|(CLP|MXN|PEN)/g, ''))); -module.exports = currencyAmount; +export default currencyAmount; diff --git a/topics/javascript/06-strings/02-practice/01-currency-amount/test/currencyAmount.spec.js b/topics/javascript/06-strings/02-practice/01-currency-amount/test/currencyAmount.spec.js index 2e362bff3..b52b7135b 100644 --- a/topics/javascript/06-strings/02-practice/01-currency-amount/test/currencyAmount.spec.js +++ b/topics/javascript/06-strings/02-practice/01-currency-amount/test/currencyAmount.spec.js @@ -1,28 +1,28 @@ -const Assert = require('chai').assert; -const currencyAmount = require('../solution/currencyAmount'); +import { assert } from 'chai'; +import currencyAmount from '../solution/currencyAmount.js'; describe('currencyAmount()', () => { it('debería regresar los montos cuando es un arreglo de montos enteros en monedas variadas', () => { const amounts = ['$ 600 CLP', '$ 1000 MXN', 'S/. 200 PEN']; const output = currencyAmount(amounts); - Assert.deepEqual(output, [600, 1000, 200]); + assert.deepEqual(output, [600, 1000, 200]); }); it('debería regresar los montos cuando es un arreglo de montos reales en monedas variadas', () => { const amounts = ['$ 825.50 CLP', '$ 999.99 MXN', 'S/. 500.25 PEN']; const output = currencyAmount(amounts); - Assert.deepEqual(output, [825.50, 999.99, 500.25]); + assert.deepEqual(output, [825.50, 999.99, 500.25]); }); it('debería regresar los montos cuando es un arreglo de montos reales con una sola moneda', () => { const amounts = ['$ 600 MXN', '$ 100.50 MXN', '$ 1349.99 MXN']; const output = currencyAmount(amounts); - Assert.deepEqual(output, [600, 100.50, 1349.99]); + assert.deepEqual(output, [600, 100.50, 1349.99]); }); it('debería regresar un arreglo vacío cuando es un arreglo vacíơ', () => { const amounts = []; const output = currencyAmount(amounts); - Assert.deepEqual(output, []); + assert.deepEqual(output, []); }); }); diff --git a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/boilerplate/firstAndLastToUpper.js b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/boilerplate/firstAndLastToUpper.js index 469fdd41d..fba78d1a7 100644 --- a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/boilerplate/firstAndLastToUpper.js +++ b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/boilerplate/firstAndLastToUpper.js @@ -2,4 +2,4 @@ const firstAndLastToUpper = (str) => { }; -module.exports = firstAndLastToUpper; +export default firstAndLastToUpper; diff --git a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/solution/firstAndLastToUpper.js b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/solution/firstAndLastToUpper.js index a694a1760..24bc27064 100644 --- a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/solution/firstAndLastToUpper.js +++ b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/solution/firstAndLastToUpper.js @@ -6,4 +6,4 @@ const firstAndLastToUpper = (str) => { return result; }; -module.exports = firstAndLastToUpper; +export default firstAndLastToUpper; diff --git a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/test/firstAndLastToUpper.spec.js b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/test/firstAndLastToUpper.spec.js index d9c0893c5..2cf55c376 100644 --- a/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/test/firstAndLastToUpper.spec.js +++ b/topics/javascript/06-strings/02-practice/02-first-and-last-to-upper/test/firstAndLastToUpper.spec.js @@ -1,14 +1,14 @@ -const Assert = require('chai').assert; -const firstAndLastToUpper = require('../solution/firstAndLastToUpper'); +import { assert } from 'chai'; +import firstAndLastToUpper from '../solution/firstAndLastToUpper.js'; describe('firstAndLastToUpper()', () => { it('debería retornar en mayúsculas la primer y última letra de un string', () => { - Assert.deepEqual(firstAndLastToUpper('murcielago'), 'MurcielagO'); - Assert.deepEqual(firstAndLastToUpper('sol'), 'SoL'); - Assert.deepEqual(firstAndLastToUpper('abecedario'), 'AbecedariO'); + assert.deepEqual(firstAndLastToUpper('murcielago'), 'MurcielagO'); + assert.deepEqual(firstAndLastToUpper('sol'), 'SoL'); + assert.deepEqual(firstAndLastToUpper('abecedario'), 'AbecedariO'); }); it('debería retornar "" si no se le ingresa ningún parametro', () => { - Assert.deepEqual(firstAndLastToUpper(''), ''); + assert.deepEqual(firstAndLastToUpper(''), ''); }); }); diff --git a/topics/javascript/09-errors/03-callbacks/files/callback.js b/topics/javascript/09-errors/03-callbacks/files/callback.js index 9f40150fd..0e7a3df6a 100644 --- a/topics/javascript/09-errors/03-callbacks/files/callback.js +++ b/topics/javascript/09-errors/03-callbacks/files/callback.js @@ -1,4 +1,4 @@ -const http = require('http'); +import http from 'http'; const saludaEnElFuturo = (nombre, segundos, cb) => { diff --git a/topics/javascript/09-errors/04-promises/files/promise.js b/topics/javascript/09-errors/04-promises/files/promise.js index d64a76c5e..93c9601f5 100644 --- a/topics/javascript/09-errors/04-promises/files/promise.js +++ b/topics/javascript/09-errors/04-promises/files/promise.js @@ -1,4 +1,4 @@ -const http = require('http'); +import http from 'http'; // const getLatestNodeInfo = () => new Promise((resolve, reject) => { // http.get('http://nodejs.org/dist/index.json', (resp) => { diff --git a/topics/javascript/09-errors/05-practice/01-validate-string/boilerplate/validateString.js b/topics/javascript/09-errors/05-practice/01-validate-string/boilerplate/validateString.js index 182bd19ad..57d332eed 100644 --- a/topics/javascript/09-errors/05-practice/01-validate-string/boilerplate/validateString.js +++ b/topics/javascript/09-errors/05-practice/01-validate-string/boilerplate/validateString.js @@ -1,3 +1,3 @@ -module.exports = (str) => { +export default (str) => { // ... }; diff --git a/topics/javascript/09-errors/05-practice/01-validate-string/solution/validateString.js b/topics/javascript/09-errors/05-practice/01-validate-string/solution/validateString.js index d7e4df53c..dd93c78e4 100644 --- a/topics/javascript/09-errors/05-practice/01-validate-string/solution/validateString.js +++ b/topics/javascript/09-errors/05-practice/01-validate-string/solution/validateString.js @@ -1,4 +1,4 @@ -module.exports = (str) => { +export default (str) => { if (typeof str !== 'string') { throw new TypeError('El argumento str debe ser un string'); } diff --git a/topics/javascript/09-errors/05-practice/01-validate-string/test/validateString.spec.js b/topics/javascript/09-errors/05-practice/01-validate-string/test/validateString.spec.js index ac166ec7a..2dea2ae21 100644 --- a/topics/javascript/09-errors/05-practice/01-validate-string/test/validateString.spec.js +++ b/topics/javascript/09-errors/05-practice/01-validate-string/test/validateString.spec.js @@ -1,14 +1,14 @@ -const Assert = require('chai').assert; -const validateString = require('../solution/validateString'); +import { assert } from 'chai'; +import validateString from '../solution/validateString.js'; describe('validateString()', () => { it('debería ser una función', () => { - Assert.equal(typeof validateString, 'function'); + assert.equal(typeof validateString, 'function'); }); it('debería arrojar TypeError cuando argumento no es srting', () => { - Assert.throws( + assert.throws( () => validateString(), TypeError, 'El argumento str debe ser un string', @@ -16,7 +16,7 @@ describe('validateString()', () => { }); it('debería arrojar RangeError cuando srting tiene menos de 4 caracteres', () => { - Assert.throws( + assert.throws( () => validateString(''), RangeError, 'El argumento str debe tener al menos 4 caracteres', @@ -24,7 +24,7 @@ describe('validateString()', () => { }); it('debería arrojar RangeError cuando srting tiene más de 10 caracteres', () => { - Assert.throws( + assert.throws( () => validateString('abcdefghijk'), RangeError, 'El argumento str debe tener un máximo de 10 caracteres', diff --git a/topics/javascript/09-errors/05-practice/02-parse-json/boilerplate/parseJson.js b/topics/javascript/09-errors/05-practice/02-parse-json/boilerplate/parseJson.js index 3190b01cd..e90d65911 100644 --- a/topics/javascript/09-errors/05-practice/02-parse-json/boilerplate/parseJson.js +++ b/topics/javascript/09-errors/05-practice/02-parse-json/boilerplate/parseJson.js @@ -2,4 +2,4 @@ const parseJson = () => { // Tu código acá }; -module.exports = parseJson; +export default parseJson; diff --git a/topics/javascript/09-errors/05-practice/02-parse-json/solution/parseJson.js b/topics/javascript/09-errors/05-practice/02-parse-json/solution/parseJson.js index d20c4bd6d..6c19e604b 100644 --- a/topics/javascript/09-errors/05-practice/02-parse-json/solution/parseJson.js +++ b/topics/javascript/09-errors/05-practice/02-parse-json/solution/parseJson.js @@ -6,4 +6,4 @@ const parseJson = (str) => { } }; -module.exports = parseJson; +export default parseJson; diff --git a/topics/javascript/09-errors/05-practice/02-parse-json/test/parseJson.spec.js b/topics/javascript/09-errors/05-practice/02-parse-json/test/parseJson.spec.js index 5c8d0ead4..2a7c0e78b 100644 --- a/topics/javascript/09-errors/05-practice/02-parse-json/test/parseJson.spec.js +++ b/topics/javascript/09-errors/05-practice/02-parse-json/test/parseJson.spec.js @@ -1,18 +1,18 @@ -const Assert = require('chai').assert; -const parseJson = require('../solution/parseJson'); +import { assert } from 'chai'; +import parseJson from '../solution/parseJson.js'; describe('parseJson()', () => { it('debería ser una función', () => { - Assert.equal(typeof parseJson, 'function'); + assert.equal(typeof parseJson, 'function'); }); it('debería devolver un error en vez de arrojarlo con JSON inválido', () => { const result = parseJson(); - Assert.ok(result instanceof SyntaxError); + assert.ok(result instanceof SyntaxError); }); it('debería devolver JSON parseado cuando formato del string es ok', () => { const result = parseJson('{ "foo": true, "bar": "baz" }'); - Assert.deepEqual(result, { foo: true, bar: 'baz' }); + assert.deepEqual(result, { foo: true, bar: 'baz' }); }); }); diff --git a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/boilerplate/sayHello.js b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/boilerplate/sayHello.js index 8bb90cb55..5bf3af84b 100644 --- a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/boilerplate/sayHello.js +++ b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/boilerplate/sayHello.js @@ -8,4 +8,4 @@ const sayHello = () => { * ESCRIBA SU RESPUESTA AQUÍ. */ -module.exports = sayHello; +export default sayHello; diff --git a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/solution/sayHello.js b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/solution/sayHello.js index 829e0dcad..883ab1187 100644 --- a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/solution/sayHello.js +++ b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/solution/sayHello.js @@ -8,4 +8,4 @@ const sayHello = () => { * A la palabra 'hola' le faltaban comillas. */ -module.exports = sayHello; +export default sayHello; diff --git a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/test/sayHello.spec.js b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/test/sayHello.spec.js index 6b2603f06..1993c9953 100644 --- a/topics/javascript/10-debugging/03-code-challenges/01-say-hello/test/sayHello.spec.js +++ b/topics/javascript/10-debugging/03-code-challenges/01-say-hello/test/sayHello.spec.js @@ -1,8 +1,8 @@ -const Assert = require('chai').assert; -const sayHello = require('../solution/sayHello'); +import { assert } from 'chai'; +import sayHello from '../solution/sayHello.js'; describe('sayHello()', () => { it('debería regresar undefined, para ()', () => { - Assert.deepEqual(sayHello(), undefined); + assert.deepEqual(sayHello(), undefined); }); }); diff --git a/topics/javascript/10-debugging/03-code-challenges/02-create-array/boilerplate/createArray.js b/topics/javascript/10-debugging/03-code-challenges/02-create-array/boilerplate/createArray.js index 7eaa8e847..ddd586489 100644 --- a/topics/javascript/10-debugging/03-code-challenges/02-create-array/boilerplate/createArray.js +++ b/topics/javascript/10-debugging/03-code-challenges/02-create-array/boilerplate/createArray.js @@ -8,4 +8,4 @@ function createArray() { * ESCRIBA SU RESPUESTA AQUÍ. */ -module.exports = createArray; +export default createArray; diff --git a/topics/javascript/10-debugging/03-code-challenges/02-create-array/solution/createArray.js b/topics/javascript/10-debugging/03-code-challenges/02-create-array/solution/createArray.js index 01e294359..c85766b9d 100644 --- a/topics/javascript/10-debugging/03-code-challenges/02-create-array/solution/createArray.js +++ b/topics/javascript/10-debugging/03-code-challenges/02-create-array/solution/createArray.js @@ -9,4 +9,4 @@ function createArray() { * Al arreglo le faltaban dos comas. */ -module.exports = createArray; +export default createArray; diff --git a/topics/javascript/10-debugging/03-code-challenges/02-create-array/test/createArray.spec.js b/topics/javascript/10-debugging/03-code-challenges/02-create-array/test/createArray.spec.js index 3e0807eb3..90c071d60 100644 --- a/topics/javascript/10-debugging/03-code-challenges/02-create-array/test/createArray.spec.js +++ b/topics/javascript/10-debugging/03-code-challenges/02-create-array/test/createArray.spec.js @@ -1,8 +1,8 @@ -const Assert = require('chai').assert; -const createArray = require('../solution/createArray'); +import { assert } from 'chai'; +import createArray from '../solution/createArray.js'; describe('createArray()', () => { it('debería regresar [1, 2, 3], para ()', () => { - Assert.deepEqual(createArray(), [1, 2, 3]); + assert.deepEqual(createArray(), [1, 2, 3]); }); }); diff --git a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/boilerplate/calculateTip.js b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/boilerplate/calculateTip.js index 616814fbc..d473911cf 100644 --- a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/boilerplate/calculateTip.js +++ b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/boilerplate/calculateTip.js @@ -9,4 +9,4 @@ const calculateTip = billAmount => percent(15, billAmount); * ESCRIBA SU RESPUESTA AQUÍ. */ -module.exports = calculateTip; +export default calculateTip; diff --git a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/solution/calculateTip.js b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/solution/calculateTip.js index cebbffaab..25c0a0637 100644 --- a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/solution/calculateTip.js +++ b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/solution/calculateTip.js @@ -10,4 +10,4 @@ const calculateTip = billAmount => percent(15, billAmount); * 2. */ -module.exports = calculateTip; +export default calculateTip; diff --git a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/test/calculateTip.spec.js b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/test/calculateTip.spec.js index 7d0cf3042..3a58fae86 100644 --- a/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/test/calculateTip.spec.js +++ b/topics/javascript/10-debugging/03-code-challenges/03-calculate-tip/test/calculateTip.spec.js @@ -1,20 +1,20 @@ -const Assert = require('chai').assert; -const calculateTip = require('../solution/calculateTip'); +import { assert } from 'chai'; +import calculateTip from '../solution/calculateTip.js'; describe('calculateTip()', () => { it('debería regresar 15, para (100)', () => { - Assert.deepEqual(calculateTip(100), 15); + assert.deepEqual(calculateTip(100), 15); }); it('debería regresar 4.5, para (30)', () => { - Assert.deepEqual(calculateTip(30), 4.5); + assert.deepEqual(calculateTip(30), 4.5); }); it('debería regresar 0, para (0)', () => { - Assert.deepEqual(calculateTip(0), 0); + assert.deepEqual(calculateTip(0), 0); }); it('debería regresar 7.5, para (50)', () => { - Assert.deepEqual(calculateTip(50), 7.5); + assert.deepEqual(calculateTip(50), 7.5); }); }); diff --git a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/boilerplate/tellFortune.js b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/boilerplate/tellFortune.js index c2c6b8223..4211f542b 100644 --- a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/boilerplate/tellFortune.js +++ b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/boilerplate/tellFortune.js @@ -7,4 +7,4 @@ function tellFortune(job, location) { * ESCRIBA SU RESPUESTA AQUÍ. */ -module.exports = tellFortune; +export default tellFortune; diff --git a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/solution/tellFortune.js b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/solution/tellFortune.js index 2010ec5bb..b785f142e 100644 --- a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/solution/tellFortune.js +++ b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/solution/tellFortune.js @@ -7,4 +7,4 @@ function tellFortune(job, location) { * A la linea 2 le faltaba un plus. */ -module.exports = tellFortune; +export default tellFortune; diff --git a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/test/tellFortune.spec.js b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/test/tellFortune.spec.js index 9d32c6e57..4c6f83459 100644 --- a/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/test/tellFortune.spec.js +++ b/topics/javascript/10-debugging/03-code-challenges/04-tell-fortune/test/tellFortune.spec.js @@ -1,20 +1,20 @@ -const Assert = require('chai').assert; -const tellFortune = require('../solution/tellFortune'); +import { assert } from 'chai'; +import tellFortune from '../solution/tellFortune.js'; describe('tellFortune()', () => { it('debería regresar "In the year 2025, you will be a programmer and live in Lima.", para ("programmer", "Lima")', () => { - Assert.deepEqual(tellFortune('programmer', 'Lima'), 'In the year 2025, you will be a programmer and live in Lima.'); + assert.deepEqual(tellFortune('programmer', 'Lima'), 'In the year 2025, you will be a programmer and live in Lima.'); }); it('debería regresar "In the year 2025, you will be a scientist and live in Boston.", para ("scientist", "Boston")', () => { - Assert.deepEqual(tellFortune('scientist', 'Boston'), 'In the year 2025, you will be a scientist and live in Boston.'); + assert.deepEqual(tellFortune('scientist', 'Boston'), 'In the year 2025, you will be a scientist and live in Boston.'); }); it('debería regresar "In the year 2025, you will be a singer and live in Madrid.", para ("singer", "Madrid")', () => { - Assert.deepEqual(tellFortune('singer', 'Madrid'), 'In the year 2025, you will be a singer and live in Madrid.'); + assert.deepEqual(tellFortune('singer', 'Madrid'), 'In the year 2025, you will be a singer and live in Madrid.'); }); it('debería regresar "In the year 2025, you will be a farmer and live in Fiji.", para ("farmer", "Fiji")', () => { - Assert.deepEqual(tellFortune('farmer', 'Fiji'), 'In the year 2025, you will be a farmer and live in Fiji.'); + assert.deepEqual(tellFortune('farmer', 'Fiji'), 'In the year 2025, you will be a farmer and live in Fiji.'); }); }); diff --git a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/boilerplate/whatToWear.js b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/boilerplate/whatToWear.js index 895c3440e..0fc2eac36 100644 --- a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/boilerplate/whatToWear.js +++ b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/boilerplate/whatToWear.js @@ -18,4 +18,4 @@ function whatToWear(season) { * ESCRIBA SU RESPUESTA AQUÍ. */ -module.exports = whatToWear; +export default whatToWear; diff --git a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/solution/whatToWear.js b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/solution/whatToWear.js index 442e914ad..3463b10d0 100644 --- a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/solution/whatToWear.js +++ b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/solution/whatToWear.js @@ -18,4 +18,4 @@ function whatToWear(season) { * Usaba operador de asignación en vez de comparación. */ -module.exports = whatToWear; +export default whatToWear; diff --git a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/test/whatToWear.spec.js b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/test/whatToWear.spec.js index db982e39e..d130e7e18 100644 --- a/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/test/whatToWear.spec.js +++ b/topics/javascript/10-debugging/03-code-challenges/05-what-to-wear/test/whatToWear.spec.js @@ -1,25 +1,25 @@ -const Assert = require('chai').assert; -const whatToWear = require('../solution/whatToWear'); +import { assert } from 'chai'; +import whatToWear from '../solution/whatToWear.js'; describe('whatToWear()', () => { it('debería regresar "Bring an umbrella.", para ("spring")', () => { - Assert.deepEqual(whatToWear('spring'), 'Bring an umbrella.'); + assert.deepEqual(whatToWear('spring'), 'Bring an umbrella.'); }); it('debería regresar "Wear sunglasses.", para ("summer")', () => { - Assert.deepEqual(whatToWear('summer'), 'Wear sunglasses.'); + assert.deepEqual(whatToWear('summer'), 'Wear sunglasses.'); }); it('debería regresar "Wear a light jacket.", para ("autumn")', () => { - Assert.deepEqual(whatToWear('autumn'), 'Wear a light jacket.'); + assert.deepEqual(whatToWear('autumn'), 'Wear a light jacket.'); }); it('debería regresar "Bring a hat and gloves.", para ("winter")', () => { - Assert.deepEqual(whatToWear('winter'), 'Bring a hat and gloves.'); + assert.deepEqual(whatToWear('winter'), 'Bring a hat and gloves.'); }); it('debería regresar "Please enter a valid season.", para ("foo")', () => { - Assert.deepEqual(whatToWear('foo'), 'Please enter a valid season.'); + assert.deepEqual(whatToWear('foo'), 'Please enter a valid season.'); }); }); diff --git a/topics/javascript/11-testing/01-basics/files/isVowel.js b/topics/javascript/11-testing/01-basics/files/isVowel.js index 6eaf70d67..33b9ccc7b 100644 --- a/topics/javascript/11-testing/01-basics/files/isVowel.js +++ b/topics/javascript/11-testing/01-basics/files/isVowel.js @@ -2,4 +2,4 @@ const isVowel = char => ['a', 'e', 'i', 'o', 'u'].indexOf(char) > -1; -module.exports = isVowel; +export default isVowel; diff --git a/topics/javascript/11-testing/01-basics/files/isVowel.spec.js b/topics/javascript/11-testing/01-basics/files/isVowel.spec.js index c0bff59c4..8cb31806c 100644 --- a/topics/javascript/11-testing/01-basics/files/isVowel.spec.js +++ b/topics/javascript/11-testing/01-basics/files/isVowel.spec.js @@ -1,6 +1,5 @@ // Archivo `isVowel.spec.js`: - -const isVowel = require('./isVowel'); +import isVowel from './isVowel.js'; console.log('debería devolver true para letra a'); if (isVowel('a') === true) { diff --git a/topics/javascript/11-testing/02-frameworks/files/isVowel.js b/topics/javascript/11-testing/02-frameworks/files/isVowel.js index 300f6a599..c3208d71c 100644 --- a/topics/javascript/11-testing/02-frameworks/files/isVowel.js +++ b/topics/javascript/11-testing/02-frameworks/files/isVowel.js @@ -2,4 +2,4 @@ const isVowel = char => ['a', 'e', 'i', 'o', 'u'].indexOf(char) > -1; -module.exports = isVowel; +export default isVowel; diff --git a/topics/javascript/11-testing/02-frameworks/files/isVowel.spec.js b/topics/javascript/11-testing/02-frameworks/files/isVowel.spec.js index 1664d4238..88f6a1b4b 100644 --- a/topics/javascript/11-testing/02-frameworks/files/isVowel.spec.js +++ b/topics/javascript/11-testing/02-frameworks/files/isVowel.spec.js @@ -1,6 +1,6 @@ // Archivo `isVowel.spec.js` -const isVowel = require('./isVowel'); +import isVowel from './isVowel.js'; describe('isVowel()', () => { it('debería devolver true para letra a', () => { diff --git a/topics/javascript/11-testing/03-assertions/files/isVowel-chai-assert.spec.js b/topics/javascript/11-testing/03-assertions/files/isVowel-chai-assert.spec.js index 0f770b3e5..6a1885791 100644 --- a/topics/javascript/11-testing/03-assertions/files/isVowel-chai-assert.spec.js +++ b/topics/javascript/11-testing/03-assertions/files/isVowel-chai-assert.spec.js @@ -1,7 +1,7 @@ // Archivo `isVowel.spec.js` -const { assert } = require('chai'); -const isVowel = require('./isVowel'); +import { assert } from 'chai'; +import isVowel from './isVowel.js'; describe('isVowel()', () => { it('debería devolver true para letra a', () => { diff --git a/topics/javascript/11-testing/03-assertions/files/isVowel-node-assert.spec.js b/topics/javascript/11-testing/03-assertions/files/isVowel-node-assert.spec.js index 2b5a1b8fe..034882201 100644 --- a/topics/javascript/11-testing/03-assertions/files/isVowel-node-assert.spec.js +++ b/topics/javascript/11-testing/03-assertions/files/isVowel-node-assert.spec.js @@ -1,7 +1,7 @@ // Archivo `isVowel.spec.js` -const assert = require('assert'); -const isVowel = require('./isVowel'); +import assert from 'assert'; +import isVowel from './isVowel.js'; describe('isVowel()', () => { it('debería devolver true para letra a', () => { diff --git a/topics/javascript/11-testing/03-assertions/files/isVowel-vanilla-assert.spec.js b/topics/javascript/11-testing/03-assertions/files/isVowel-vanilla-assert.spec.js index 31407c009..8ee811263 100644 --- a/topics/javascript/11-testing/03-assertions/files/isVowel-vanilla-assert.spec.js +++ b/topics/javascript/11-testing/03-assertions/files/isVowel-vanilla-assert.spec.js @@ -1,6 +1,6 @@ // Archivo `isVowel.spec.js` -const isVowel = require('./isVowel'); +import isVowel from './isVowel.js'; const assertEqual = (value, expected) => { if (value !== expected) { diff --git a/topics/javascript/11-testing/03-assertions/files/isVowel.js b/topics/javascript/11-testing/03-assertions/files/isVowel.js index 300f6a599..c3208d71c 100644 --- a/topics/javascript/11-testing/03-assertions/files/isVowel.js +++ b/topics/javascript/11-testing/03-assertions/files/isVowel.js @@ -2,4 +2,4 @@ const isVowel = char => ['a', 'e', 'i', 'o', 'u'].indexOf(char) > -1; -module.exports = isVowel; +export default isVowel; diff --git a/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.js b/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.js index 7f33cb5d8..52fa5ef88 100644 --- a/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.js +++ b/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.js @@ -24,6 +24,5 @@ const makeVowelsUpperCase = (string) => { return result; }; -if (typeof module !== 'undefined') { - module.exports = makeVowelsUpperCase; -} +// TODO look at this case +export default makeVowelsUpperCase; diff --git a/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.spec.js b/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.spec.js index 63fd4e9b4..d84a845d6 100644 --- a/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.spec.js +++ b/topics/javascript/11-testing/04-browser/files/makeVowelsUpperCase.spec.js @@ -1,14 +1,6 @@ -/* global assert: true, makeVowelsUpperCase: true */ -/* eslint global-require: "off" */ - -if (typeof assert === 'undefined') { - assert = require('assert'); -} - -if (typeof makeVowelsUpperCase === 'undefined') { - makeVowelsUpperCase = require('./makeVowelsUpperCase'); -} - +// TODO what is different about this case? +import { assert } from 'chai'; +import makeVowelsUpperCase from './makeVowelsUpperCase.js'; describe('makeVowelsUpperCase()', () => { it('debería convertir "hola mundo" en "hOlA mUndO"', () => { diff --git a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/boilerplate/printPrimes.js b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/boilerplate/printPrimes.js index eb6f7f86b..a49541535 100644 --- a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/boilerplate/printPrimes.js +++ b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/boilerplate/printPrimes.js @@ -20,4 +20,4 @@ function printPrimes() { } } -module.exports = printPrimes; +export default printPrimes; diff --git a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/solution/printPrimes.js b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/solution/printPrimes.js index 59c0884ea..6ebeeff72 100644 --- a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/solution/printPrimes.js +++ b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/solution/printPrimes.js @@ -13,4 +13,4 @@ function printPrimes() { } } -module.exports = printPrimes; +export default printPrimes; diff --git a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/test/printPrimes.spec.js b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/test/printPrimes.spec.js index ff38e376f..4611dc3e3 100644 --- a/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/test/printPrimes.spec.js +++ b/topics/paradigms/01-paradigms/04-imperative-exercise/01-print-primes/test/printPrimes.spec.js @@ -1,6 +1,6 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/printPrimes'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/printPrimes.js'; describe('printPrimes()', () => { @@ -10,16 +10,16 @@ describe('printPrimes()', () => { stub.restore(); it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería invocar console.log 8 veces', () => { - Assert.equal(stub.callCount, 8); + assert.equal(stub.callCount, 8); }); [[2], [3], [5], [7], [11], [13], [17], [19]].forEach((args, idx) => { it(`invocación ${idx + 1} a console.log debería recibir "${args[0]}" como único argumento`, () => { - Assert.deepEqual(args, stub.getCall(idx).args); + assert.deepEqual(args, stub.getCall(idx).args); }); }); diff --git a/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/solution/getPrimes.js b/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/solution/getPrimes.js index 4b92d0efa..1c8d4572b 100644 --- a/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/solution/getPrimes.js +++ b/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/solution/getPrimes.js @@ -1,4 +1,4 @@ -function isPrime(num) { +export function isPrime(num) { for (let i = 2; i <= (num / 2); i++) { if (num % i == 0) { return false; @@ -7,7 +7,7 @@ function isPrime(num) { return true; } -function getPrimes(start, end) { +export function getPrimes(start, end) { const primes = []; for (let i = start; i < end; i++) { if (isPrime(i)) { @@ -17,5 +17,3 @@ function getPrimes(start, end) { return primes; } -exports.getPrimes = getPrimes; -exports.isPrime = isPrime; diff --git a/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/test/getPrimes.spec.js b/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/test/getPrimes.spec.js index 1d489dc26..be64c2f91 100644 --- a/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/test/getPrimes.spec.js +++ b/topics/paradigms/01-paradigms/07-procedural-exercise/01-get-primes/test/getPrimes.spec.js @@ -1,19 +1,19 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/getPrimes'); +import { assert } from 'chai'; +import * as Submission from '../solution/getPrimes.js'; describe('getPrimes(start, end)', () => { it('debería exportar función `getPrimes`', () => { - Assert.equal(typeof Submission.getPrimes, 'function'); + assert.equal(typeof Submission.getPrimes, 'function'); }); it('debería retornar los número primos menores de 20', () => { - Assert.deepEqual(Submission.getPrimes(2, 20), [2, 3, 5, 7, 11, 13, 17, 19]); + assert.deepEqual(Submission.getPrimes(2, 20), [2, 3, 5, 7, 11, 13, 17, 19]); }); it('debería retornar los número primos entre 50 y 100', () => { - Assert.deepEqual(Submission.getPrimes(50, 100), [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]); + assert.deepEqual(Submission.getPrimes(50, 100), [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]); }); }); @@ -22,19 +22,19 @@ describe('getPrimes(start, end)', () => { describe('isPrime(num)', () => { it('debería exportar función `isPrime`', () => { - Assert.equal(typeof Submission.isPrime, 'function'); + assert.equal(typeof Submission.isPrime, 'function'); }); it('debería retornar true para 2, 3, 5, 13, 89', () => { - [2, 3, 5, 13, 89].forEach(n => Assert.deepEqual(Submission.isPrime(n), true)); + [2, 3, 5, 13, 89].forEach(n => assert.deepEqual(Submission.isPrime(n), true)); }); it('debería retornar false para ', () => { - [4, 10, 99, 411].forEach(n => Assert.deepEqual(Submission.isPrime(n), false)); + [4, 10, 99, 411].forEach(n => assert.deepEqual(Submission.isPrime(n), false)); }); it('debería retornar los número primos entre 50 y 100', () => { - Assert.deepEqual(Submission.getPrimes(50, 100), [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]); + assert.deepEqual(Submission.getPrimes(50, 100), [53, 59, 61, 67, 71, 73, 79, 83, 89, 97]); }); }); diff --git a/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/solution/notes.js b/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/solution/notes.js index db832dea3..c6b364fdc 100644 --- a/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/solution/notes.js +++ b/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/solution/notes.js @@ -1,4 +1,4 @@ -function Note(text) { +export function Note(text) { this.text = text || ''; this.createdAt = new Date(); this.completed = false; @@ -12,7 +12,7 @@ Note.prototype.toString = function () { }; -function Notes() { +export function Notes() { this.data = []; } @@ -35,6 +35,3 @@ Notes.prototype.toString = function () { return str; }; - -exports.Note = Note; -exports.Notes = Notes; diff --git a/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/test/notes.spec.js b/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/test/notes.spec.js index 57d6dac0d..15a79b9d6 100644 --- a/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/test/notes.spec.js +++ b/topics/paradigms/01-paradigms/09-oop-exercise/01-notes/test/notes.spec.js @@ -1,24 +1,21 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/notes'); -const Note = Submission.Note; -const Notes = Submission.Notes; - +import { assert } from 'chai'; +import { Note, Notes } from '../solution/notes.js'; describe('Note', () => { it('debería exportar función `Note`', () => { - Assert.equal(typeof Note, 'function'); + assert.equal(typeof Note, 'function'); }); it('debería crear un nuevo objeto cuando invocamos new Note()', () => { const note = new Note('renovar dni'); - Assert.equal(note.text, 'renovar dni'); - Assert.ok(note.createdAt instanceof Date); - Assert.equal(note.completed, false); + assert.equal(note.text, 'renovar dni'); + assert.ok(note.createdAt instanceof Date); + assert.equal(note.completed, false); }); - it('debería retornar undefined cuando invocamos Note() sin "new"', () => { - Assert.equal(Note('renovar dni'), undefined); + it('debería tirar un error cuando invocamos Note() sin "new"', () => { + assert.throws(_ => Note('renovar dni'), TypeError); }); }); @@ -29,9 +26,9 @@ describe('Note#toString', () => { it('debería convertir objeto a string', () => { const note = new Note('foo'); const date = (new Date()).toDateString(); - Assert.equal(note.toString(), '[ ] | ' + date + ' | foo'); + assert.equal(note.toString(), '[ ] | ' + date + ' | foo'); note.completed = true; - Assert.equal(note.toString(), '[X] | ' + date + ' | foo'); + assert.equal(note.toString(), '[X] | ' + date + ' | foo'); }); }); @@ -40,7 +37,7 @@ describe('Note#toString', () => { describe('Notes (oop)', () => { it('debería exportar función `Notes`', () => { - Assert.equal(typeof Notes, 'function'); + assert.equal(typeof Notes, 'function'); }); }); @@ -55,14 +52,14 @@ describe('Notes#add', () => { ].forEach((val) => { const notes = new Notes(); - Assert.throws(_ => notes.add(val), Error); + assert.throws(_ => notes.add(val), Error); }); }); it('debería permitir añadir instancias de Note', () => { const notes = new Notes(); - Assert.doesNotThrow(_ => notes.add(new Note('one'))); + assert.doesNotThrow(_ => notes.add(new Note('one'))); }); }); @@ -72,7 +69,7 @@ describe('Notes#toString', () => { it('debería retornar un string vacío cuando no hay notas', () => { const notes = new Notes(); - Assert.equal(notes.toString(), ''); + assert.equal(notes.toString(), ''); }); @@ -84,14 +81,14 @@ describe('Notes#toString', () => { notes.add(note1); notes.add(new Note('two')); - Assert.equal(notes.toString(), [ + assert.equal(notes.toString(), [ '[ ] | ' + date + ' | two', '[ ] | ' + date + ' | one' ].join('\n')); note1.completed = true; - Assert.equal(notes.toString(), [ + assert.equal(notes.toString(), [ '[ ] | ' + date + ' | two', '[X] | ' + date + ' | one' ].join('\n')); diff --git a/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/solution/notes.js b/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/solution/notes.js index 4cd95f6f9..eeeee4e7a 100644 --- a/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/solution/notes.js +++ b/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/solution/notes.js @@ -1,20 +1,16 @@ -const createNote = text => ({ +export const createNote = text => ({ text, createdAt: new Date(), completed: false }); -const noteToString = note => [ +export const noteToString = note => [ '[' + (note.completed ? 'X' : ' ') + ']', ' | ' + note.createdAt.toDateString(), ' | ' + note.text ].join(''); -const createNotes = array => array.map(createNote); +export const createNotes = array => array.map(createNote); -const notesToString = notes => notes.map(noteToString).join('\n'); +export const notesToString = notes => notes.map(noteToString).join('\n'); -exports.createNote = createNote; -exports.noteToString = noteToString; -exports.createNotes = createNotes; -exports.notesToString = notesToString; diff --git a/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/test/notes.spec.js b/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/test/notes.spec.js index 7ff8ac83a..51e80be2c 100644 --- a/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/test/notes.spec.js +++ b/topics/paradigms/01-paradigms/11-fp-exercise/01-notes/test/notes.spec.js @@ -1,20 +1,20 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/notes'); +import { assert } from 'chai'; +import * as Submission from '../solution/notes.js'; const { createNote, noteToString, createNotes, notesToString } = Submission; describe('createNote()', () => { it('debería exportar función `createNote`', () => { - Assert.equal(typeof createNote, 'function'); + assert.equal(typeof createNote, 'function'); }); it('debería crear un objeto con los campos esperados', () => { const note = createNote('renovar dni'); - Assert.equal(note.text, 'renovar dni'); - Assert.ok(note.createdAt instanceof Date); - Assert.equal(note.completed, false); - Assert.equal(note.__proto__, Object.prototype); + assert.equal(note.text, 'renovar dni'); + assert.ok(note.createdAt instanceof Date); + assert.equal(note.completed, false); + assert.equal(note.__proto__, Object.prototype); }); }); @@ -22,15 +22,15 @@ describe('createNote()', () => { describe('noteToString()', () => { it('debería exportar función `noteToString`', () => { - Assert.equal(typeof noteToString, 'function'); + assert.equal(typeof noteToString, 'function'); }); it('debería convertir objeto a string', () => { const note = createNote('foo'); const date = (new Date()).toDateString(); - Assert.equal(noteToString(note), '[ ] | ' + date + ' | foo'); + assert.equal(noteToString(note), '[ ] | ' + date + ' | foo'); note.completed = true; - Assert.equal(noteToString(note), '[X] | ' + date + ' | foo'); + assert.equal(noteToString(note), '[X] | ' + date + ' | foo'); }); }); @@ -38,7 +38,7 @@ describe('noteToString()', () => { describe('createNotes()', () => { it('debería exportar función `createNotes`', () => { - Assert.equal(typeof createNotes, 'function'); + assert.equal(typeof createNotes, 'function'); }); }); @@ -46,12 +46,12 @@ describe('createNotes()', () => { describe('notesToString()', () => { it('debería exportar función `notesToString`', () => { - Assert.equal(typeof notesToString, 'function'); + assert.equal(typeof notesToString, 'function'); }); it('debería retornar un string vacío cuando no hay notas', () => { const notes = createNotes([]); - Assert.equal(notesToString(notes), ''); + assert.equal(notesToString(notes), ''); }); @@ -61,14 +61,14 @@ describe('notesToString()', () => { notes.unshift(createNote('two')); - Assert.equal(notesToString(notes), [ + assert.equal(notesToString(notes), [ '[ ] | ' + date + ' | two', '[ ] | ' + date + ' | one' ].join('\n')); notes[1].completed = true; - Assert.equal(notesToString(notes), [ + assert.equal(notesToString(notes), [ '[ ] | ' + date + ' | two', '[X] | ' + date + ' | one' ].join('\n')); diff --git a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/boilerplate/simpleObjects.js b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/boilerplate/simpleObjects.js index 3ab599dd5..c3081324d 100644 --- a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/boilerplate/simpleObjects.js +++ b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/boilerplate/simpleObjects.js @@ -3,4 +3,4 @@ __ // Exports de Common JS para verificación, no modificar -module.exports = { robot }; +export default { robot }; diff --git a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/solution/simpleObjects.js b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/solution/simpleObjects.js index 1674bde1a..a1f73e086 100644 --- a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/solution/simpleObjects.js +++ b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/solution/simpleObjects.js @@ -2,4 +2,4 @@ const robot = { smart: true }; -module.exports = { robot }; +export default { robot }; diff --git a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/test/simpleObjects.spec.js b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/test/simpleObjects.spec.js index f8051159a..e5cb41628 100644 --- a/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/test/simpleObjects.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/01-simple-objects/test/simpleObjects.spec.js @@ -1,29 +1,32 @@ const globalScope = (typeof WorkerNavigator !== 'undefined' ? WorkerNavigator : global); -const Assert = globalScope.Assert = require('chai').assert; -const Submission = require('../solution/simpleObjects'); +// TODO this case is weird, why imported in this way with global and require? +// import Assert = globalScope.Assert from 'chai').assert; +// const assert = globalScope.Assert; +import { assert } from 'chai'; +import Submission from '../solution/simpleObjects.js'; describe('module', () => { it('debería exportar un objeto con una propiedad "robot"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('robot')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('robot')); }); describe('robot', () => { it('debería ser un objeto', () => { - Assert.equal(typeof Submission.robot, 'object'); + assert.equal(typeof Submission.robot, 'object'); }); it('debería tener una propiedad "smart"', () => { - Assert.ok(Submission.robot.hasOwnProperty('smart')); + assert.ok(Submission.robot.hasOwnProperty('smart')); }); describe('robot.smart', () => { it('debería ser true', () => { - Assert.equal(Submission.robot.smart, true); + assert.equal(Submission.robot.smart, true); }); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/02-proto/boilerplate/proto.js b/topics/paradigms/03-proto/04-ejercicios/02-proto/boilerplate/proto.js index d05effae5..ffbb6d7e3 100644 --- a/topics/paradigms/03-proto/04-ejercicios/02-proto/boilerplate/proto.js +++ b/topics/paradigms/03-proto/04-ejercicios/02-proto/boilerplate/proto.js @@ -24,7 +24,7 @@ claim(robby.friendly, __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { machine, robot, robby, diff --git a/topics/paradigms/03-proto/04-ejercicios/02-proto/solution/proto.js b/topics/paradigms/03-proto/04-ejercicios/02-proto/solution/proto.js index 174e210df..bed645649 100644 --- a/topics/paradigms/03-proto/04-ejercicios/02-proto/solution/proto.js +++ b/topics/paradigms/03-proto/04-ejercicios/02-proto/solution/proto.js @@ -1,3 +1,8 @@ +import { assert } from 'chai'; +import Sinon from 'sinon'; +const globalScope = (typeof self !== 'undefined' ? self : global); +const claim = globalScope.claim = (actual, expected) => assert.equal(actual, expected); + const machine = { motors: 4 }; @@ -16,7 +21,7 @@ claim(robby.motors, 4); claim(robby.friendly, true); -module.exports = { +export default { machine, robot, robby, diff --git a/topics/paradigms/03-proto/04-ejercicios/02-proto/test/proto.spec.js b/topics/paradigms/03-proto/04-ejercicios/02-proto/test/proto.spec.js index c57c29d16..4d2138026 100644 --- a/topics/paradigms/03-proto/04-ejercicios/02-proto/test/proto.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/02-proto/test/proto.spec.js @@ -1,78 +1,78 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); -const claim = globalScope.claim = (actual, expected) => Assert.equal(actual, expected); +const claim = globalScope.claim = (actual, expected) => assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/proto'); +import Submission from '../solution/proto.js'; const { machine, robot, robby } = Submission; describe('proto', () => { it('debería exportar un objeto con las propiedades "machine", "robot" y "robby"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('machine')); - Assert.ok(Submission.hasOwnProperty('robot')); - Assert.ok(Submission.hasOwnProperty('robby')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('machine')); + assert.ok(Submission.hasOwnProperty('robot')); + assert.ok(Submission.hasOwnProperty('robby')); }); it('debería invocar claim 2 veces', () => { - Assert.equal(spy.callCount, 2); + assert.equal(spy.callCount, 2); }); describe('primera invocación a claim', () => { it('debería comparar 4 con 4', () => { - Assert.deepEqual(spy.getCall(0).args, [4, 4]); + assert.deepEqual(spy.getCall(0).args, [4, 4]); }) }); describe('segunda invocación a claim', () => { it('debería comparar true con true', () => { - Assert.deepEqual(spy.getCall(1).args, [true, true]); + assert.deepEqual(spy.getCall(1).args, [true, true]); }) }); describe('machine', () => { it('debería ser un objeto con una propiedad "motors"', () => { - Assert.equal(typeof machine, 'object'); - Assert.ok(machine.hasOwnProperty('motors')); + assert.equal(typeof machine, 'object'); + assert.ok(machine.hasOwnProperty('motors')); }); describe('machine.motors', () => - it('debería ser 4', () => Assert.equal(machine.motors, 4))); + it('debería ser 4', () => assert.equal(machine.motors, 4))); }); describe('robot', () => { it('debería ser un objeto con una propiedad "friendly"', () => { - Assert.equal(typeof robot, 'object'); - Assert.ok(robot.hasOwnProperty('friendly')); + assert.equal(typeof robot, 'object'); + assert.ok(robot.hasOwnProperty('friendly')); }); describe('robot.friendly', () => - it('debería ser true', () => Assert.equal(robot.friendly, true))); + it('debería ser true', () => assert.equal(robot.friendly, true))); }); describe('robby', () => { it('debería ser un objeto sin propiedades propias', () => { - Assert.equal(Object.keys(robby).length, 0); + assert.equal(Object.keys(robby).length, 0); }); describe('robby.__proto__', () => - it('debería ser robot', () => Assert.equal(robby.__proto__, robot))); + it('debería ser robot', () => assert.equal(robby.__proto__, robot))); describe('robby.__proto__.__proto__', () => - it('debería ser machine', () => Assert.equal(robby.__proto__.__proto__, machine))); + it('debería ser machine', () => assert.equal(robby.__proto__.__proto__, machine))); describe('robby.motors', () => - it('debería resolver a 4', () => Assert.equal(robby.motors, 4))); + it('debería resolver a 4', () => assert.equal(robby.motors, 4))); describe('robby.friendly', () => - it('debería resolver a true', () => Assert.equal(robby.friendly, true))); + it('debería resolver a true', () => assert.equal(robby.friendly, true))); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/boilerplate/dynamicLookups.js b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/boilerplate/dynamicLookups.js index ceecba080..de7a15336 100644 --- a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/boilerplate/dynamicLookups.js +++ b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/boilerplate/dynamicLookups.js @@ -25,7 +25,7 @@ claim(robot.motors, __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { machine, vehicle, robot, diff --git a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/solution/dynamicLookups.js b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/solution/dynamicLookups.js index 2fbf3790a..e69e7a98c 100644 --- a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/solution/dynamicLookups.js +++ b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/solution/dynamicLookups.js @@ -19,7 +19,7 @@ claim(vehicle.motors, 4); claim(robot.motors, 4); // ------------------------------------------------ -module.exports = { +export default { machine, vehicle, robot, diff --git a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/test/dynamicLookups.spec.js b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/test/dynamicLookups.spec.js index 7c11758bd..5c27ecf00 100644 --- a/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/test/dynamicLookups.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/03-dynamic-lookups/test/dynamicLookups.spec.js @@ -1,23 +1,23 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); -const claim = globalScope.claim = (actual, expected) => Assert.equal(actual, expected); +const claim = globalScope.claim = (actual, expected) => assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/dynamicLookups'); +import Submission from '../solution/dynamicLookups.js'; const { machine, vehicle, robot } = Submission; describe('dynamicLookup', () => { it('debería exportar un objeto con las propiedades "machine", "vehicle" y "robot"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('machine')); - Assert.ok(Submission.hasOwnProperty('vehicle')); - Assert.ok(Submission.hasOwnProperty('robot')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('machine')); + assert.ok(Submission.hasOwnProperty('vehicle')); + assert.ok(Submission.hasOwnProperty('robot')); }); it('debería invocar claim 4 veces', () => { - Assert.equal(spy.callCount, 4); + assert.equal(spy.callCount, 4); }); [ @@ -28,7 +28,7 @@ describe('dynamicLookup', () => { ].forEach((args, idx) => { describe(`invocación ${idx + 1} a claim`, () => { it(`debería comparar ${args[0]} con ${args[1]}`, () => { - Assert.deepEqual(spy.getCall(idx).args, args); + assert.deepEqual(spy.getCall(idx).args, args); }) }); }); @@ -36,44 +36,44 @@ describe('dynamicLookup', () => { describe('machine', () => { it('debería ser un objeto con una propiedad "motors"', () => { - Assert.equal(typeof machine, 'object'); - Assert.ok(machine.hasOwnProperty('motors')); + assert.equal(typeof machine, 'object'); + assert.ok(machine.hasOwnProperty('motors')); }); describe('machine.motors', () => - it('debería ser 4', () => Assert.equal(machine.motors, 4))); + it('debería ser 4', () => assert.equal(machine.motors, 4))); }); describe('vehicle', () => { it('debería ser un objeto sin propiedades propias', () => { - Assert.equal(typeof vehicle, 'object'); - Assert.equal(Object.keys(vehicle).length, 0); + assert.equal(typeof vehicle, 'object'); + assert.equal(Object.keys(vehicle).length, 0); }); it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(vehicle.__proto__, machine); + assert.equal(vehicle.__proto__, machine); }); describe('vehicle.motors', () => - it('debería resolver a 4', () => Assert.equal(vehicle.motors, 4))); + it('debería resolver a 4', () => assert.equal(vehicle.motors, 4))); }); describe('robot', () => { it('debería ser un objeto sin propiedades propias', () => { - Assert.equal(typeof robot, 'object'); - Assert.equal(Object.keys(robot).length, 0); + assert.equal(typeof robot, 'object'); + assert.equal(Object.keys(robot).length, 0); }); it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(robot.__proto__, machine); + assert.equal(robot.__proto__, machine); }); describe('robot.motors', () => - it('debería resolver a 4', () => Assert.equal(robot.motors, 4))); + it('debería resolver a 4', () => assert.equal(robot.motors, 4))); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/boilerplate/propertyAssignments.js b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/boilerplate/propertyAssignments.js index d742425dc..c0e3a06bc 100644 --- a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/boilerplate/propertyAssignments.js +++ b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/boilerplate/propertyAssignments.js @@ -22,7 +22,7 @@ claim(vehicle.motors, __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { machine, vehicle, robot, diff --git a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/solution/propertyAssignments.js b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/solution/propertyAssignments.js index ebf7e164f..5e87db719 100644 --- a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/solution/propertyAssignments.js +++ b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/solution/propertyAssignments.js @@ -16,7 +16,7 @@ claim(machine.motors, null); claim(robot.motors, 4); claim(vehicle.motors, null); -module.exports = { +export default { machine, vehicle, robot, diff --git a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/test/propertyAssignments.spec.js b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/test/propertyAssignments.spec.js index 0c9a2b624..97c7b4fba 100644 --- a/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/test/propertyAssignments.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/04-property-assignments/test/propertyAssignments.spec.js @@ -1,23 +1,23 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); -const claim = globalScope.claim = (actual, expected) => Assert.equal(actual, expected); +const claim = globalScope.claim = (actual, expected) => assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/propertyAssignments'); +import Submission from '../solution/propertyAssignments.js'; const { machine, vehicle, robot } = Submission; describe('propertyAssignments', () => { it('debería exportar un objeto con las propiedades "machine", "vehicle" y "robot"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('machine')); - Assert.ok(Submission.hasOwnProperty('vehicle')); - Assert.ok(Submission.hasOwnProperty('robot')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('machine')); + assert.ok(Submission.hasOwnProperty('vehicle')); + assert.ok(Submission.hasOwnProperty('robot')); }); it('debería invocar claim 6 veces', () => { - Assert.equal(spy.callCount, 6); + assert.equal(spy.callCount, 6); }); [ @@ -30,7 +30,7 @@ describe('propertyAssignments', () => { ].forEach((args, idx) => { describe(`invocación ${idx + 1} a claim`, () => it(`debería comparar ${args[0]} con ${args[1]}`, () => - Assert.deepEqual(spy.getCall(idx).args, args) + assert.deepEqual(spy.getCall(idx).args, args) ) ); }); @@ -38,11 +38,11 @@ describe('propertyAssignments', () => { describe('machine', () => { it('debería tener una propiedad motors', () => { - Assert.ok(robot.hasOwnProperty('motors')); + assert.ok(robot.hasOwnProperty('motors')); }); describe('machine.motors', () => - it('debería tener valor null', () => Assert.equal(machine.motors, null)) + it('debería tener valor null', () => assert.equal(machine.motors, null)) ); }); @@ -50,7 +50,7 @@ describe('propertyAssignments', () => { describe('vehicle', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(vehicle.__proto__, machine); + assert.equal(vehicle.__proto__, machine); }); }); @@ -58,15 +58,15 @@ describe('propertyAssignments', () => { describe('robot', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(robot.__proto__, machine); + assert.equal(robot.__proto__, machine); }); it('debería tener una propiedad motors', () => { - Assert.ok(robot.hasOwnProperty('motors')); + assert.ok(robot.hasOwnProperty('motors')); }); describe('robot.motors', () => - it('debería tener valor 4', () => Assert.equal(robot.motors, 4)) + it('debería tener valor 4', () => assert.equal(robot.motors, 4)) ); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/boilerplate/arraysAndObjects.js b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/boilerplate/arraysAndObjects.js index fdff4f1ca..f35371296 100644 --- a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/boilerplate/arraysAndObjects.js +++ b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/boilerplate/arraysAndObjects.js @@ -42,7 +42,7 @@ claim(vehicle.capabilities, __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { machine: machine, vehicle: vehicle, robot: robot diff --git a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/solution/arraysAndObjects.js b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/solution/arraysAndObjects.js index 1b38a8259..1e3099924 100644 --- a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/solution/arraysAndObjects.js +++ b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/solution/arraysAndObjects.js @@ -3,6 +3,11 @@ // array vacío como valor: `[]` // -> En la definición de `machine` incluye una propiedad 'capabilities', y // asígnale un objeto vacío: `{}` +import { assert } from 'chai'; +import Sinon from 'sinon'; +const globalScope = (typeof self !== 'undefined' ? self : global); +const claim = globalScope.claim = (actual, expected) => assert.deepEqual(actual, expected); +const spy = Sinon.spy(globalScope, 'claim'); const machine = { parts: [], @@ -42,7 +47,7 @@ vehicle.capabilities.fly = true; claim(robot.capabilities, {fly: true}); claim(vehicle.capabilities, {fly: true}); -module.exports = { +export default { machine, vehicle, robot diff --git a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/test/arraysAndObjects.spec.js b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/test/arraysAndObjects.spec.js index b65f0dce7..d482f6c7f 100644 --- a/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/test/arraysAndObjects.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/05-arrays-and-objects/test/arraysAndObjects.spec.js @@ -1,28 +1,28 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/arraysAndObjects'); +import Submission from '../solution/arraysAndObjects.js'; const { machine, vehicle, robot } = Submission; describe('arraysAndObjects', () => { it('debería exportar un objeto con las propiedades "machine", "vehicle" y "robot"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('machine')); - Assert.ok(Submission.hasOwnProperty('vehicle')); - Assert.ok(Submission.hasOwnProperty('robot')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('machine')); + assert.ok(Submission.hasOwnProperty('vehicle')); + assert.ok(Submission.hasOwnProperty('robot')); }); it('debería invocar claim 8 veces', () => { - Assert.equal(spy.callCount, 8); + assert.equal(spy.callCount, 8); }); [[['core'], []], @@ -36,7 +36,7 @@ describe('arraysAndObjects', () => { ].forEach((args, idx) => { describe(`invocación ${idx + 1} a claim`, () => it(`debería comparar ${args[0]} con ${args[1]}`, () => - Assert.deepEqual(spy.getCall(idx).args, args) + assert.deepEqual(spy.getCall(idx).args, args) ) ); }) @@ -44,19 +44,19 @@ describe('arraysAndObjects', () => { describe('machine', () => { it('debería tener una propiedad parts y capabilities', () => { - Assert.ok(machine.hasOwnProperty('parts')); - Assert.ok(machine.hasOwnProperty('capabilities')); + assert.ok(machine.hasOwnProperty('parts')); + assert.ok(machine.hasOwnProperty('capabilities')); }); describe('machine.parts', () => { it('debería tener valor ["core"]', () => { - Assert.deepEqual(machine.parts, ['core']); + assert.deepEqual(machine.parts, ['core']); }); }); describe('machine.capabilities', () => { it('debería tener valor { fly: true }', () => { - Assert.deepEqual(machine.capabilities, { fly: true }); + assert.deepEqual(machine.capabilities, { fly: true }); }); }); }); @@ -64,14 +64,14 @@ describe('arraysAndObjects', () => { describe('vehicle', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(vehicle.__proto__, machine); + assert.equal(vehicle.__proto__, machine); }); }) describe('robot', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(robot.__proto__, machine); + assert.equal(robot.__proto__, machine); }); }) diff --git a/topics/paradigms/03-proto/04-ejercicios/06-object-create/boilerplate/objectCreate.js b/topics/paradigms/03-proto/04-ejercicios/06-object-create/boilerplate/objectCreate.js index 08a2f7587..2cd747235 100644 --- a/topics/paradigms/03-proto/04-ejercicios/06-object-create/boilerplate/objectCreate.js +++ b/topics/paradigms/03-proto/04-ejercicios/06-object-create/boilerplate/objectCreate.js @@ -21,7 +21,7 @@ claim(Object.getPrototypeOf(robby), __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { machine, robot, robby diff --git a/topics/paradigms/03-proto/04-ejercicios/06-object-create/solution/objectCreate.js b/topics/paradigms/03-proto/04-ejercicios/06-object-create/solution/objectCreate.js index 1e65bb7f7..708f38134 100644 --- a/topics/paradigms/03-proto/04-ejercicios/06-object-create/solution/objectCreate.js +++ b/topics/paradigms/03-proto/04-ejercicios/06-object-create/solution/objectCreate.js @@ -13,7 +13,7 @@ claim(robot.isPrototypeOf(robby), true); claim(Object.getPrototypeOf(robby), robot); // ------------------------------------------------ -module.exports = { +export default { machine, robot, robby diff --git a/topics/paradigms/03-proto/04-ejercicios/06-object-create/test/objectCreate.spec.js b/topics/paradigms/03-proto/04-ejercicios/06-object-create/test/objectCreate.spec.js index 63b1cae72..bba2e5c25 100644 --- a/topics/paradigms/03-proto/04-ejercicios/06-object-create/test/objectCreate.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/06-object-create/test/objectCreate.spec.js @@ -1,27 +1,27 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/objectCreate'); +import Submission from '../solution/objectCreate.js'; const { machine, robot, robby } = Submission; describe('objectCreate', () => { it('debería exportar un objeto con las propiedades "machine", "robot" y "robby"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('machine')); - Assert.ok(Submission.hasOwnProperty('robot')); - Assert.ok(Submission.hasOwnProperty('robby')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('machine')); + assert.ok(Submission.hasOwnProperty('robot')); + assert.ok(Submission.hasOwnProperty('robby')); }); it('debería invocar claim 3 veces', () => { - Assert.equal(spy.callCount, 3); + assert.equal(spy.callCount, 3); }); [ @@ -31,7 +31,7 @@ describe('objectCreate', () => { ].forEach((args, idx) => { describe(`invocación ${idx + 1} a claim`, () => it(`debería comparar ${args[0]} con ${args[1]}`, () => - Assert.deepEqual(spy.getCall(idx).args, args) + assert.deepEqual(spy.getCall(idx).args, args) ) ); }); @@ -39,18 +39,18 @@ describe('objectCreate', () => { describe('robot', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(robot.__proto__, machine); + assert.equal(robot.__proto__, machine); }); }); describe('robby', () => { it('debería ser un objeto con machine como prototipo', () => { - Assert.equal(robby.__proto__.__proto__, machine); + assert.equal(robby.__proto__.__proto__, machine); }); it('debería ser un objeto con robot como prototipo', () => { - Assert.equal(robby.__proto__, robot); + assert.equal(robby.__proto__, robot); }); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/boilerplate/dotNew.js b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/boilerplate/dotNew.js index 8bd6407da..9bd324be4 100644 --- a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/boilerplate/dotNew.js +++ b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/boilerplate/dotNew.js @@ -10,6 +10,6 @@ __ // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { Robot } diff --git a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/solution/dotNew.js b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/solution/dotNew.js index 517740967..775cf7ee4 100644 --- a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/solution/dotNew.js +++ b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/solution/dotNew.js @@ -12,7 +12,5 @@ const Robot = { } // ------------------------------------------------ -// Exports de Common JS para verificación, no modificar -module.exports = { - Robot -} +// Exports para verificación, no modificar +export { Robot }; diff --git a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/test/dotNew.spec.js b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/test/dotNew.spec.js index 7f18b4b56..e2b50d2b9 100644 --- a/topics/paradigms/03-proto/04-ejercicios/07-dot-new/test/dotNew.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/07-dot-new/test/dotNew.spec.js @@ -1,33 +1,33 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/dotNew'); +import * as Submission from '../solution/dotNew.js'; const { Robot } = Submission; describe('dotNew', () => { it('debería exportar un objeto con las propiedades "Robot"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('Robot')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('Robot')); }); describe('Robot', () => { it('debería tener una función llamada "new"', () => { - Assert.equal(typeof Robot.new, 'function'); + assert.equal(typeof Robot.new, 'function'); }); describe('Robot.new', () => { it('debería devolver un objeto que tiene como prototipo a Robot', () => { - Assert.equal(Robot.new().__proto__, Robot); + assert.equal(Robot.new().__proto__, Robot); }); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/boilerplate/constructorFunctions.js b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/boilerplate/constructorFunctions.js index 41a8fba37..31b112c96 100644 --- a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/boilerplate/constructorFunctions.js +++ b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/boilerplate/constructorFunctions.js @@ -14,7 +14,7 @@ claim(robby.motors, __); // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { Robot, robby } diff --git a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/solution/constructorFunctions.js b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/solution/constructorFunctions.js index f7a258cc1..bd68f8aee 100644 --- a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/solution/constructorFunctions.js +++ b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/solution/constructorFunctions.js @@ -16,8 +16,8 @@ claim(robby instanceof Robot, true); claim(robby.motors, 2); // ------------------------------------------------ -// Exports de Common JS para verificación, no modificar -module.exports = { +// Exports para verificación, no modificar +export { Robot, robby } diff --git a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/test/constructorFunctions.spec.js b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/test/constructorFunctions.spec.js index 4c81f88ac..dde19703c 100644 --- a/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/test/constructorFunctions.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/08-constructor-functions/test/constructorFunctions.spec.js @@ -1,26 +1,26 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/constructorFunctions'); +import * as Submission from '../solution/constructorFunctions.js'; const { Robot, robby } = Submission; describe('objectCreate', () => { it('debería exportar un objeto con las propiedades "Robot", "robby"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('Robot')); - Assert.ok(Submission.hasOwnProperty('robby')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('Robot')); + assert.ok(Submission.hasOwnProperty('robby')); }); it('debería invocar claim 2 veces', () => { - Assert.equal(spy.callCount, 2); + assert.equal(spy.callCount, 2); }); [ @@ -29,7 +29,7 @@ describe('objectCreate', () => { ].forEach((args, idx) => { describe(`invocación ${idx + 1} a claim`, () => it(`debería comparar ${args[0]} con ${args[1]}`, () => - Assert.deepEqual(spy.getCall(idx).args, args) + assert.deepEqual(spy.getCall(idx).args, args) ) ); }); @@ -37,7 +37,7 @@ describe('objectCreate', () => { describe('Robot', () => { it('debería ser un constructor', () => { - Assert.equal(typeof Robot, 'function'); + assert.equal(typeof Robot, 'function'); }); }); @@ -45,11 +45,11 @@ describe('objectCreate', () => { describe('robby', () => { it('debería ser una una instancia de robot', () => { - Assert.equal(robby.__proto__, new Robot().__proto__); + assert.equal(robby.__proto__, new Robot().__proto__); }); it('debería tener una propiedad motors con valor 2', () => { - Assert.equal(robby.motors, 2); + assert.equal(robby.motors, 2); }); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/boilerplate/implicitThis.js b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/boilerplate/implicitThis.js index 6ed4d122c..bed769633 100644 --- a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/boilerplate/implicitThis.js +++ b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/boilerplate/implicitThis.js @@ -8,7 +8,7 @@ __ // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { Robot, Vehicle } diff --git a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/solution/implicitThis.js b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/solution/implicitThis.js index 2b36a3a71..7b6e9a99e 100644 --- a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/solution/implicitThis.js +++ b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/solution/implicitThis.js @@ -13,7 +13,7 @@ function Vehicle() { // ------------------------------------------------ // Exports de Common JS para verificación, no modificar -module.exports = { +export default { Robot, Vehicle } diff --git a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/test/implicitThis.spec.js b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/test/implicitThis.spec.js index 4a2c7be31..ad4bc9378 100644 --- a/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/test/implicitThis.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/09-implicit-this/test/implicitThis.spec.js @@ -1,35 +1,35 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/implicitThis'); +import Submission from '../solution/implicitThis.js'; const { Robot, Vehicle } = Submission; describe('implicitThis', () => { it('debería exportar un objeto con las propiedades "Robot", "Vehicle"', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('Robot')); - Assert.ok(Submission.hasOwnProperty('Vehicle')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.hasOwnProperty('Robot')); + assert.ok(Submission.hasOwnProperty('Vehicle')); }); describe('Robot', () => { it('debería ser un constructor', () => { - Assert.equal(typeof Robot, 'function'); + assert.equal(typeof Robot, 'function'); }); describe('new Robot', () => { it('debería retornar una instancia de robot', () => { const robot = new Robot(); - Assert.equal(robot instanceof Robot, true); + assert.equal(robot instanceof Robot, true); }) }) @@ -38,14 +38,14 @@ describe('implicitThis', () => { describe('Vehicle', () => { it('debería ser un constructor', () => { - Assert.equal(typeof Vehicle, 'function'); + assert.equal(typeof Vehicle, 'function'); }); describe('new Vehicle', () => { it('no debería retornar una instancia de Vehicle', () => { const vehicle = new Vehicle(); - Assert.equal(vehicle instanceof Vehicle, false); + assert.equal(vehicle instanceof Vehicle, false); }); }); diff --git a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/boilerplate/functionPrototype.js b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/boilerplate/functionPrototype.js index d2b135373..317b4bea4 100644 --- a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/boilerplate/functionPrototype.js +++ b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/boilerplate/functionPrototype.js @@ -32,8 +32,8 @@ claim(cranky.capabilities, __); // ------------------------------------------------ -// Exports de Common JS para verificación, no modificar -module.exports = { +// Exports para verificación, no modificar +export { Robot, robby, cranky diff --git a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/solution/functionPrototype.js b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/solution/functionPrototype.js index c8dffe89b..324994768 100644 --- a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/solution/functionPrototype.js +++ b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/solution/functionPrototype.js @@ -37,8 +37,8 @@ claim(robby.capabilities, ['fly']); claim(cranky.capabilities, ['fly']); // ------------------------------------------------ -// Exports de Common JS para verificación, no modificar -module.exports = { +// Exports para verificación, no modificar +export { Robot, robby, cranky diff --git a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/test/functionPrototype.spec.js b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/test/functionPrototype.spec.js index 31a8d71d6..c342c0a76 100644 --- a/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/test/functionPrototype.spec.js +++ b/topics/paradigms/03-proto/04-ejercicios/10-function-prototype/test/functionPrototype.spec.js @@ -1,51 +1,51 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); +import { assert } from 'chai'; +import Sinon from 'sinon'; const globalScope = (typeof self !== 'undefined' ? self : global); const claim = globalScope.claim = (actual, expected) => Array.isArray(expected) || (typeof expected === 'object' && expected instanceof Object) ? - Assert.deepEqual(actual, expected) : - Assert.equal(actual, expected); + assert.deepEqual(actual, expected) : + assert.equal(actual, expected); const spy = Sinon.spy(globalScope, 'claim'); -const Submission = require('../solution/functionPrototype'); +import * as Submission from '../solution/functionPrototype.js'; const { Robot, robby, cranky } = Submission; describe('functionPrototype', () => { it('debería exportar un objeto con las propiedades "Robot", "robby", "cranky" ', () => { - Assert.equal(typeof Submission, 'object'); - Assert.ok(Submission.hasOwnProperty('Robot')); - Assert.ok(Submission.hasOwnProperty('robby')); - Assert.ok(Submission.hasOwnProperty('cranky')); + assert.equal(typeof Submission, 'object'); + assert.ok(Submission.Robot); + assert.ok(Submission.robby); + assert.ok(Submission.cranky); }); describe('Robot', () => { it('debería ser una función', () => { - Assert.isFunction(Robot); + assert.isFunction(Robot); }); it('debería tener una instancia de parts', () => { const other = new Robot(); - Assert.isDefined(other.parts); + assert.isDefined(other.parts); }); it('debería tener una instancia de capabilities', () => { const other = new Robot(); - Assert.isDefined(other.capabilities); + assert.isDefined(other.capabilities); }); it('debería comenzar vacío', () => { const other = new Robot(); - Assert.equal(other.parts.length, 0); + assert.equal(other.parts.length, 0); }); describe('Robot.parts', () => { it('debería ser un array', () => { const other = new Robot(); - Assert.isArray(other.parts); + assert.isArray(other.parts); }) }); @@ -53,7 +53,7 @@ describe('functionPrototype', () => { it('debería ser un array', () => { const other = new Robot(); - Assert.isArray(other.capabilities); + assert.isArray(other.capabilities); }); }); @@ -62,25 +62,25 @@ describe('functionPrototype', () => { describe('robby', () => { it('debería ser una instancia de Robot', () => { - Assert.instanceOf(robby, Robot); + assert.instanceOf(robby, Robot); }); it('debería tener un elemento', () => { - Assert.equal(robby.parts.length, 1); + assert.equal(robby.parts.length, 1); }); it('debería tener un elemento que sea "core"', () => { - Assert.equal(robby.parts[0], 'core'); + assert.equal(robby.parts[0], 'core'); }); describe('robby.capabilities', () => { it('debería tener un elemento', () => { - Assert.equal(robby.capabilities.length, 1); + assert.equal(robby.capabilities.length, 1); }); it('Su primer elemento debería ser "fly"', () => { - Assert.equal(robby.capabilities[0], 'fly'); + assert.equal(robby.capabilities[0], 'fly'); }); }); @@ -89,13 +89,13 @@ describe('functionPrototype', () => { describe('cranky', () => { it('debería ser una instancia de Robot', () => { - Assert.instanceOf(cranky, Robot); + assert.instanceOf(cranky, Robot); }); describe('cranky.parts', () => { it('debería tener 0 elementos', () => { - Assert.equal(cranky.parts.length, 0); + assert.equal(cranky.parts.length, 0); }); }); @@ -103,15 +103,15 @@ describe('functionPrototype', () => { describe('cranky.capabilities', () => { it('no esta agregado directamente a cranky', () => { - Assert.isFalse(cranky.hasOwnProperty('capabilities')); + assert.isFalse(cranky.hasOwnProperty('capabilities')); }); it('debería tener un elemento', () => { - Assert.equal(cranky.capabilities.length, 1); + assert.equal(cranky.capabilities.length, 1); }); it('Su primer elemento debería ser "fly"', () => { - Assert.equal(cranky.capabilities[0], 'fly'); + assert.equal(cranky.capabilities[0], 'fly'); }); }) diff --git a/topics/paradigms/06-composition/05-exercises/01-hof/boilerplate/hof.js b/topics/paradigms/06-composition/05-exercises/01-hof/boilerplate/hof.js index b59e85d05..f51685d7d 100644 --- a/topics/paradigms/06-composition/05-exercises/01-hof/boilerplate/hof.js +++ b/topics/paradigms/06-composition/05-exercises/01-hof/boilerplate/hof.js @@ -6,7 +6,7 @@ // ejecutar la función `num` veces. // -module.exports = function repeat(operation, num) { +export default function repeat(operation, num) { //Escribe aquí tu código. }; diff --git a/topics/paradigms/06-composition/05-exercises/01-hof/solution/hof.js b/topics/paradigms/06-composition/05-exercises/01-hof/solution/hof.js index a8db1fa75..fee8b7ebb 100644 --- a/topics/paradigms/06-composition/05-exercises/01-hof/solution/hof.js +++ b/topics/paradigms/06-composition/05-exercises/01-hof/solution/hof.js @@ -1,4 +1,4 @@ -module.exports = function repeat(operation, num) { +export default function repeat(operation, num) { if (num <= 0) { return; } diff --git a/topics/paradigms/06-composition/05-exercises/01-hof/test/hof.spec.js b/topics/paradigms/06-composition/05-exercises/01-hof/test/hof.spec.js index 36510e520..44f8c9ebc 100644 --- a/topics/paradigms/06-composition/05-exercises/01-hof/test/hof.spec.js +++ b/topics/paradigms/06-composition/05-exercises/01-hof/test/hof.spec.js @@ -1,17 +1,17 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/hof'); +import { assert } from 'chai'; +import Submission from '../solution/hof.js'; describe('repeat', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería invocar la operación num veces', () => { let count = 0; Submission(_ => count++, 3); - Assert.equal(count, 3); + assert.equal(count, 3); }); }); diff --git a/topics/paradigms/06-composition/05-exercises/02-map/boilerplate/map.js b/topics/paradigms/06-composition/05-exercises/02-map/boilerplate/map.js index c1d248fcf..66e87b62b 100644 --- a/topics/paradigms/06-composition/05-exercises/02-map/boilerplate/map.js +++ b/topics/paradigms/06-composition/05-exercises/02-map/boilerplate/map.js @@ -5,7 +5,7 @@ // `Array#map`. // -module.exports = function doubleAll(numbers) { +export default function doubleAll(numbers) { const result = []; for (let i = 0; i < numbers.length; i++) { diff --git a/topics/paradigms/06-composition/05-exercises/02-map/solution/map.js b/topics/paradigms/06-composition/05-exercises/02-map/solution/map.js index c55534cae..6c3420528 100644 --- a/topics/paradigms/06-composition/05-exercises/02-map/solution/map.js +++ b/topics/paradigms/06-composition/05-exercises/02-map/solution/map.js @@ -1 +1 @@ -module.exports = numbers => numbers.map(num => num * 2); +export default numbers => numbers.map(num => num * 2); diff --git a/topics/paradigms/06-composition/05-exercises/02-map/test/map.spec.js b/topics/paradigms/06-composition/05-exercises/02-map/test/map.spec.js index 38ff0bd9e..4b7b56baa 100644 --- a/topics/paradigms/06-composition/05-exercises/02-map/test/map.spec.js +++ b/topics/paradigms/06-composition/05-exercises/02-map/test/map.spec.js @@ -1,21 +1,21 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/map'); +import { assert } from 'chai'; +import Submission from '../solution/map.js'; describe('doubleAll()', () => { it('debería retornar array con números multiplicados por 2', () => { - Assert.deepEqual(Submission([1, 2, 3]), [2, 4, 6]); + assert.deepEqual(Submission([1, 2, 3]), [2, 4, 6]); }); it('NO debería modificar array de entrada', () => { const input = [1, 2, 3]; - Assert.deepEqual(Submission(input), [2, 4, 6]); - Assert.deepEqual(input, [1, 2, 3]); + assert.deepEqual(Submission(input), [2, 4, 6]); + assert.deepEqual(input, [1, 2, 3]); }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); }); it('debería invocar Array.prototype.map', () => { @@ -31,9 +31,9 @@ describe('doubleAll()', () => { }); }; - Assert.deepEqual(Submission([1, 2, 3]), [2, 4, 6]); - Assert.equal(mapCount, 1); - Assert.equal(operationCount, 3); + assert.deepEqual(Submission([1, 2, 3]), [2, 4, 6]); + assert.equal(mapCount, 1); + assert.equal(operationCount, 3); Array.prototype.map = map; }); diff --git a/topics/paradigms/06-composition/05-exercises/03-filter/boilerplate/filter.js b/topics/paradigms/06-composition/05-exercises/03-filter/boilerplate/filter.js index a4d727cd7..1e529db52 100644 --- a/topics/paradigms/06-composition/05-exercises/03-filter/boilerplate/filter.js +++ b/topics/paradigms/06-composition/05-exercises/03-filter/boilerplate/filter.js @@ -6,7 +6,7 @@ // caracteres. // -module.exports = function getShortMessages(messages) { +export function getShortMessages(messages) { // Escribe aquí tu código. }; diff --git a/topics/paradigms/06-composition/05-exercises/03-filter/solution/filter.js b/topics/paradigms/06-composition/05-exercises/03-filter/solution/filter.js index e4f198dff..f276df7b4 100644 --- a/topics/paradigms/06-composition/05-exercises/03-filter/solution/filter.js +++ b/topics/paradigms/06-composition/05-exercises/03-filter/solution/filter.js @@ -1,4 +1,4 @@ -module.exports = messages => +export default messages => messages .filter(item => item.message.length < 50) .map(item => item.message); diff --git a/topics/paradigms/06-composition/05-exercises/03-filter/test/filter.spec.js b/topics/paradigms/06-composition/05-exercises/03-filter/test/filter.spec.js index 4662e2e38..fddfd17e2 100644 --- a/topics/paradigms/06-composition/05-exercises/03-filter/test/filter.spec.js +++ b/topics/paradigms/06-composition/05-exercises/03-filter/test/filter.spec.js @@ -1,9 +1,9 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/filter'); +import { assert } from 'chai'; +import Submission from '../solution/filter.js'; const message = () => { - return Assert.deepEqual(Submission([{ + return assert.deepEqual(Submission([{ message: 'Tempor quis esse consequat sunt ea eiusmod.' }, { message: 'Id culpgetShortMessages.speca ad proident ad nulla laborum incididunt. Blah blah' @@ -22,7 +22,7 @@ const message = () => { describe('getShortMessages()', () => { it('debería retornar [ ] cuando input array es [ ]', () => { - Assert.deepEqual(Submission([]), []); + assert.deepEqual(Submission([]), []); }); it('debería retornar arreglo de strings con mensajes de menos de 50 chars', () => { @@ -30,7 +30,7 @@ describe('getShortMessages()', () => { }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); }); it('debería invocar Array.prototype.filter', () => { @@ -45,7 +45,7 @@ describe('getShortMessages()', () => { }; message(); - Assert.equal(filterCount, 1); + assert.equal(filterCount, 1); Array.prototype.filter = filter; }); @@ -61,7 +61,7 @@ describe('getShortMessages()', () => { }); }; message(); - Assert.equal(mapCount, 1); + assert.equal(mapCount, 1); Array.prototype.map = map; }); diff --git a/topics/paradigms/06-composition/05-exercises/04-reduce/boilerplate/reduce.js b/topics/paradigms/06-composition/05-exercises/04-reduce/boilerplate/reduce.js index c256141f7..222a60ccd 100644 --- a/topics/paradigms/06-composition/05-exercises/04-reduce/boilerplate/reduce.js +++ b/topics/paradigms/06-composition/05-exercises/04-reduce/boilerplate/reduce.js @@ -6,6 +6,6 @@ // Retorna el object directamente (no hay necesidad de hacer `console.log`). // -module.exports = (arr) => { +export default (arr) => { // ... }; diff --git a/topics/paradigms/06-composition/05-exercises/04-reduce/solution/reduce.js b/topics/paradigms/06-composition/05-exercises/04-reduce/solution/reduce.js index e8d00c824..a9022aa29 100644 --- a/topics/paradigms/06-composition/05-exercises/04-reduce/solution/reduce.js +++ b/topics/paradigms/06-composition/05-exercises/04-reduce/solution/reduce.js @@ -1,4 +1,4 @@ -module.exports = (arr) => arr.reduce((countMap, word) => { +export default (arr) => arr.reduce((countMap, word) => { countMap[word] = ++countMap[word] || 1; return countMap; }, {}); diff --git a/topics/paradigms/06-composition/05-exercises/04-reduce/test/reduce.spec.js b/topics/paradigms/06-composition/05-exercises/04-reduce/test/reduce.spec.js index c39b5ba74..c557129e5 100644 --- a/topics/paradigms/06-composition/05-exercises/04-reduce/test/reduce.spec.js +++ b/topics/paradigms/06-composition/05-exercises/04-reduce/test/reduce.spec.js @@ -1,16 +1,16 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/reduce'); +import { assert } from 'chai'; +import Submission from '../solution/reduce.js'; describe('countWords()', () => { it('debería retornar un objeto que contenga el número de veces que aparece cada string en el array', () => { const input = ['Apple', 'Banana', 'Apple', 'Durian', 'Durian', 'Durian']; - Assert.deepEqual(Submission(input), { Apple: 2, Banana: 1, Durian: 3 }); + assert.deepEqual(Submission(input), { Apple: 2, Banana: 1, Durian: 3 }); }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(Submission.toString()), false); }); it('debería invocar Array.prototype.reduce', () => { @@ -24,8 +24,8 @@ describe('countWords()', () => { }, initial); }; - Assert.deepEqual(Submission(['foo', 'foo']), { foo: 2 }); - Assert.equal(reduceCount, 1); + assert.deepEqual(Submission(['foo', 'foo']), { foo: 2 }); + assert.equal(reduceCount, 1); Array.prototype.reduce = reduce; }); diff --git a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/boilerplate/arrowFunctions.js b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/boilerplate/arrowFunctions.js index a51e3acd3..d71e6a860 100644 --- a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/boilerplate/arrowFunctions.js +++ b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/boilerplate/arrowFunctions.js @@ -1,19 +1,19 @@ -exports.repeat = (operation, num) => { +export const repeat = (operation, num) => { // Escribe tu código aquí. }; -exports.doubleAll = (numbers) => { +export const doubleAll = (numbers) => { // Escribe tu código aquí. }; -exports.getShortMessages = (messages) => { +export const getShortMessages = (messages) => { //Escribe tu código aquí. }; -exports.countWords = (arr) => { +export const countWords = (arr) => { //Escribe tu código aquí. }; diff --git a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/solution/arrowFunctions.js b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/solution/arrowFunctions.js index 90066f720..d01841ec5 100644 --- a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/solution/arrowFunctions.js +++ b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/solution/arrowFunctions.js @@ -1,18 +1,18 @@ -exports.repeat = (operation, num) => { +export const repeat = (operation, num) => { if (num <= 0) { return; } operation(); - return exports.repeat(operation, --num); + return repeat(operation, --num); }; -exports.doubleAll = numbers => numbers.map(num => num * 2); +export const doubleAll = numbers => numbers.map(num => num * 2); -exports.getShortMessages = messages => messages +export const getShortMessages = messages => messages .filter(item => item.message.length < 50) .map(item => item.message); -exports.countWords = arr => arr.reduce((countMap, word) => { + export const countWords = arr => arr.reduce((countMap, word) => { countMap[word] = ++countMap[word] || 1; return countMap; }, {}); diff --git a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/test/arrowFunctions.spec.js b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/test/arrowFunctions.spec.js index 682f61acb..b7345f325 100644 --- a/topics/paradigms/06-composition/05-exercises/05-arrow-functions/test/arrowFunctions.spec.js +++ b/topics/paradigms/06-composition/05-exercises/05-arrow-functions/test/arrowFunctions.spec.js @@ -1,10 +1,10 @@ 'use strict'; -const Assert = require('chai').assert; -const { getShortMessages, repeat, doubleAll, countWords } = require('../solution/arrowFunctions'); +import { assert } from 'chai'; +import { getShortMessages, repeat, doubleAll, countWords } from '../solution/arrowFunctions.js'; const message = (_ => { - return Assert.deepEqual(getShortMessages([{ + return assert.deepEqual(getShortMessages([{ message: 'Tempor quis esse consequat sunt ea eiusmod.' }, { message: 'Id culpgetShortMessages.speca ad proident ad nulla laborum incididunt. Blah blah' @@ -24,7 +24,7 @@ describe('Arrow functions', () => { describe('getShortMessages()', () => { it('debería retornar [] cuando input array es []', () => { - Assert.deepEqual(getShortMessages([]), []); + assert.deepEqual(getShortMessages([]), []); }); it('debería retornar arreglo de strings con mensajes de menos de 50 chars', () => { @@ -32,7 +32,7 @@ describe('Arrow functions', () => { }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(getShortMessages.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(getShortMessages.toString()), false); }); it('debería invocar Array.prototype.filter', () => { @@ -47,7 +47,7 @@ describe('Arrow functions', () => { }; message(); - Assert.equal(filterCount, 1); + assert.equal(filterCount, 1); Array.prototype.filter = filter; }); @@ -65,7 +65,7 @@ describe('Arrow functions', () => { message(); - Assert.equal(mapCount, 1); + assert.equal(mapCount, 1); Array.prototype.map = map; }); @@ -75,13 +75,13 @@ describe('Arrow functions', () => { describe('repeat', () => { it('debería exportar una función', () => { - Assert.equal(typeof repeat, 'function'); + assert.equal(typeof repeat, 'function'); }); it('debería invocar la operación num veces', () => { let count = 0; repeat( _ => count++, 3); - Assert.equal(count, 3); + assert.equal(count, 3); }); }); @@ -89,17 +89,17 @@ describe('Arrow functions', () => { describe('doubleAll()', () => { it('debería retornar array con números multiplicados por 2', () => { - Assert.deepEqual(doubleAll([1, 2, 3]), [2, 4, 6]); + assert.deepEqual(doubleAll([1, 2, 3]), [2, 4, 6]); }); it('NO debería modificar array de entrada', () => { const input = [1, 2, 3]; - Assert.deepEqual(doubleAll(input), [2, 4, 6]); - Assert.deepEqual(input, [1, 2, 3]); + assert.deepEqual(doubleAll(input), [2, 4, 6]); + assert.deepEqual(input, [1, 2, 3]); }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(doubleAll.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(doubleAll.toString()), false); }); it('debería invocar Array.prototype.map', () => { @@ -115,9 +115,9 @@ describe('Arrow functions', () => { }); }; - Assert.deepEqual(doubleAll([1, 2, 3]), [2, 4, 6]); - Assert.equal(mapCount, 1); - Assert.equal(operationCount, 3); + assert.deepEqual(doubleAll([1, 2, 3]), [2, 4, 6]); + assert.equal(mapCount, 1); + assert.equal(operationCount, 3); Array.prototype.map = map; }); @@ -128,11 +128,11 @@ describe('Arrow functions', () => { it('debería retornar un objeto que contenga el número de veces que aparece cada string en el array', () => { const input = ['Apple', 'Banana', 'Apple', 'Durian', 'Durian', 'Durian']; - Assert.deepEqual(countWords(input), { Apple: 2, Banana: 1, Durian: 3 }); + assert.deepEqual(countWords(input), { Apple: 2, Banana: 1, Durian: 3 }); }); it('NO debería usar for o while', () => { - Assert.equal(/(for|while)\s+\(/g.test(countWords.toString()), false); + assert.equal(/(for|while)\s+\(/g.test(countWords.toString()), false); }); it('debería invocar Array.prototype.reduce', () => { @@ -146,8 +146,8 @@ describe('Arrow functions', () => { }, initial); }; - Assert.deepEqual(countWords(['foo', 'foo']), { foo: 2 }); - Assert.equal(reduceCount, 1); + assert.deepEqual(countWords(['foo', 'foo']), { foo: 2 }); + assert.equal(reduceCount, 1); Array.prototype.reduce = reduce; }); diff --git a/topics/paradigms/06-composition/05-exercises/06-closures/boilerplate/closures.js b/topics/paradigms/06-composition/05-exercises/06-closures/boilerplate/closures.js index e1cceb24a..d52d8d884 100644 --- a/topics/paradigms/06-composition/05-exercises/06-closures/boilerplate/closures.js +++ b/topics/paradigms/06-composition/05-exercises/06-closures/boilerplate/closures.js @@ -3,4 +3,4 @@ const createLogger = function (namespace) { }; -module.exports = createLogger; +export default createLogger; diff --git a/topics/paradigms/06-composition/05-exercises/06-closures/solution/closures.js b/topics/paradigms/06-composition/05-exercises/06-closures/solution/closures.js index e42689d00..af80c9d37 100644 --- a/topics/paradigms/06-composition/05-exercises/06-closures/solution/closures.js +++ b/topics/paradigms/06-composition/05-exercises/06-closures/solution/closures.js @@ -1,3 +1,3 @@ const createLogger = namespace => str => console.log(`[${namespace}]: ${str}`); -module.exports = createLogger; +export default createLogger; diff --git a/topics/paradigms/06-composition/05-exercises/06-closures/test/closures.spec.js b/topics/paradigms/06-composition/05-exercises/06-closures/test/closures.spec.js index 5635b7d10..5be60b37f 100644 --- a/topics/paradigms/06-composition/05-exercises/06-closures/test/closures.spec.js +++ b/topics/paradigms/06-composition/05-exercises/06-closures/test/closures.spec.js @@ -1,16 +1,16 @@ -const Assert = require('chai').assert; -const Sinon = require('sinon'); -const Submission = require('../solution/closures'); +import { assert } from 'chai'; +import Sinon from 'sinon'; +import Submission from '../solution/closures.js'; describe('createLogger()', () => { it('debería de ser una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería de retornar una función', () => { - Assert.equal(typeof Submission(), 'function'); + assert.equal(typeof Submission(), 'function'); }); it('debería de retornar una función que imprime a la consola con el namespace', () => { @@ -18,8 +18,8 @@ describe('createLogger()', () => { const warn = Submission('warning'); warn('houston, we have a problem'); - Assert.equal(stub.callCount, 1); - Assert.equal(stub.getCall(0).args[0], '[warning]: houston, we have a problem'); + assert.equal(stub.callCount, 1); + assert.equal(stub.getCall(0).args[0], '[warning]: houston, we have a problem'); stub.restore(); }); diff --git a/topics/paradigms/06-composition/05-exercises/07-factories/boilerplate/factories.js b/topics/paradigms/06-composition/05-exercises/07-factories/boilerplate/factories.js index 805f79473..13899081d 100644 --- a/topics/paradigms/06-composition/05-exercises/07-factories/boilerplate/factories.js +++ b/topics/paradigms/06-composition/05-exercises/07-factories/boilerplate/factories.js @@ -1,4 +1,4 @@ -module.exports = function createStore() { +export default function createStore() { // TAREA // Implementa una función que se llame `createStore`. Esta función no recibe // ningún argumento y retorna un objeto con los siguientes métodos: diff --git a/topics/paradigms/06-composition/05-exercises/07-factories/solution/factories.js b/topics/paradigms/06-composition/05-exercises/07-factories/solution/factories.js index aabc8592d..13d2d27da 100644 --- a/topics/paradigms/06-composition/05-exercises/07-factories/solution/factories.js +++ b/topics/paradigms/06-composition/05-exercises/07-factories/solution/factories.js @@ -1,4 +1,4 @@ -module.exports = function createStore() { +export default function createStore() { let data = {}; diff --git a/topics/paradigms/06-composition/05-exercises/07-factories/test/factories.spec.js b/topics/paradigms/06-composition/05-exercises/07-factories/test/factories.spec.js index 6b1d8dcee..5f92c1bf5 100644 --- a/topics/paradigms/06-composition/05-exercises/07-factories/test/factories.spec.js +++ b/topics/paradigms/06-composition/05-exercises/07-factories/test/factories.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/factories'); +import { assert } from 'chai'; +import Submission from '../solution/factories.js'; const store = Submission(); @@ -8,23 +8,23 @@ describe('Factories', () => { describe('createStore()', () => { it('debería exportar una función', () => { - Assert.equal(typeof Submission, 'function'); + assert.equal(typeof Submission, 'function'); }); it('debería retornar un objeto con método get', () => { - Assert.equal(typeof store.get, 'function'); + assert.equal(typeof store.get, 'function'); }); it('debería retornar un objeto con método set', () => { - Assert.equal(typeof store.set, 'function'); + assert.equal(typeof store.set, 'function'); }); it('debería retornar un objeto con método keys', () => { - Assert.equal(typeof store.keys, 'function'); + assert.equal(typeof store.keys, 'function'); }); it('debería retornar un objeto con método clear', () => { - Assert.equal(typeof store.clear, 'function'); + assert.equal(typeof store.clear, 'function'); }); }); @@ -33,11 +33,11 @@ describe('Factories', () => { it('deberían retornar el valor guardado en la llave específicada', () => { const store = Submission(); - Assert.equal(store.get('foo'), undefined); - Assert.equal(store.set('foo', true), true); - Assert.equal(store.get('foo'), true); - Assert.equal(store.set('foo', 'lalala'), 'lalala'); - Assert.equal(store.get('foo'), 'lalala'); + assert.equal(store.get('foo'), undefined); + assert.equal(store.set('foo', true), true); + assert.equal(store.get('foo'), true); + assert.equal(store.set('foo', 'lalala'), 'lalala'); + assert.equal(store.get('foo'), 'lalala'); }); }); @@ -46,11 +46,11 @@ describe('Factories', () => { it('debería retornar un arreglo con las llaves del store', () => { const store = Submission(); - Assert.deepEqual(store.keys(), []); - Assert.equal(store.set('foo', true), true); - Assert.deepEqual(store.keys(), ['foo']); - Assert.equal(store.set('bar', 'lalala'), 'lalala'); - Assert.deepEqual(store.keys(), ['foo', 'bar']); + assert.deepEqual(store.keys(), []); + assert.equal(store.set('foo', true), true); + assert.deepEqual(store.keys(), ['foo']); + assert.equal(store.set('bar', 'lalala'), 'lalala'); + assert.deepEqual(store.keys(), ['foo', 'bar']); }); }); @@ -58,13 +58,13 @@ describe('Factories', () => { describe('store.clear()', () => { it('debería vaciar el store', () => { - Assert.deepEqual(store.keys(), []); - Assert.equal(store.set('foo', true), true); - Assert.deepEqual(store.keys(), ['foo']); - Assert.equal(store.set('bar', 'lalala'), 'lalala'); - Assert.deepEqual(store.keys(), ['foo', 'bar']); - Assert.deepEqual(store.clear(), {}); - Assert.deepEqual(store.keys(), []); + assert.deepEqual(store.keys(), []); + assert.equal(store.set('foo', true), true); + assert.deepEqual(store.keys(), ['foo']); + assert.equal(store.set('bar', 'lalala'), 'lalala'); + assert.deepEqual(store.keys(), ['foo', 'bar']); + assert.deepEqual(store.clear(), {}); + assert.deepEqual(store.keys(), []); }); }); diff --git a/topics/paradigms/06-composition/05-exercises/08-object-assign/boilerplate/objectAssign.js b/topics/paradigms/06-composition/05-exercises/08-object-assign/boilerplate/objectAssign.js index 8501e155a..ce898e7ec 100644 --- a/topics/paradigms/06-composition/05-exercises/08-object-assign/boilerplate/objectAssign.js +++ b/topics/paradigms/06-composition/05-exercises/08-object-assign/boilerplate/objectAssign.js @@ -1,3 +1,3 @@ -exports.extend = function () { +export const extend = function () { // Escribe aquí tu código. }; diff --git a/topics/paradigms/06-composition/05-exercises/08-object-assign/solution/objectAssign.js b/topics/paradigms/06-composition/05-exercises/08-object-assign/solution/objectAssign.js index ad5f34565..f03ef1abc 100644 --- a/topics/paradigms/06-composition/05-exercises/08-object-assign/solution/objectAssign.js +++ b/topics/paradigms/06-composition/05-exercises/08-object-assign/solution/objectAssign.js @@ -1,4 +1,4 @@ -exports.extend = (...sources) => Object.assign({}, ...sources); +export const extend = (...sources) => Object.assign({}, ...sources); // Implementación usando `bind` (aplicación parcial) // exports.extend = Object.assign.bind(Object, {}); diff --git a/topics/paradigms/06-composition/05-exercises/08-object-assign/test/objectAssign.spec.js b/topics/paradigms/06-composition/05-exercises/08-object-assign/test/objectAssign.spec.js index 326f9178d..181fec988 100644 --- a/topics/paradigms/06-composition/05-exercises/08-object-assign/test/objectAssign.spec.js +++ b/topics/paradigms/06-composition/05-exercises/08-object-assign/test/objectAssign.spec.js @@ -1,15 +1,15 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/objectAssign'); +import { assert } from 'chai'; +import * as Submission from '../solution/objectAssign.js'; describe('extend', () => { it('debería exportar un objeto', () => { - Assert.equal(typeof Submission, 'object'); + assert.equal(typeof Submission, 'object'); }); it('debería exportar el objeto con un método "extend"', () => { - Assert.equal(typeof Submission.extend, 'function'); + assert.equal(typeof Submission.extend, 'function'); }); it('debería crear un objeto nuevo con todas las propiedades de las fuentes', () => { @@ -18,13 +18,13 @@ describe('extend', () => { const obj3 = { baz: 2, bar: false }; const obj4 = Submission.extend(obj1); - Assert.deepEqual(obj4, { foo: true, bar: false }); + assert.deepEqual(obj4, { foo: true, bar: false }); obj4.foo = 'hola'; - Assert.deepEqual(obj4, { foo: 'hola', bar: false }); - Assert.deepEqual(obj1, { foo: true, bar: false }); + assert.deepEqual(obj4, { foo: 'hola', bar: false }); + assert.deepEqual(obj1, { foo: true, bar: false }); - Assert.deepEqual(Submission.extend(obj1, obj2), { foo: true, bar: true, baz: 1 }); - Assert.deepEqual(Submission.extend(obj1, obj2, obj3), { foo: true, bar: false, baz: 2 }); + assert.deepEqual(Submission.extend(obj1, obj2), { foo: true, bar: true, baz: 1 }); + assert.deepEqual(Submission.extend(obj1, obj2, obj3), { foo: true, bar: false, baz: 2 }); }); }); diff --git a/topics/paradigms/06-composition/05-exercises/09-composition/boilerplate/composition.js b/topics/paradigms/06-composition/05-exercises/09-composition/boilerplate/composition.js index bcb142165..5f7c886dc 100644 --- a/topics/paradigms/06-composition/05-exercises/09-composition/boilerplate/composition.js +++ b/topics/paradigms/06-composition/05-exercises/09-composition/boilerplate/composition.js @@ -32,17 +32,17 @@ const robot = name => { return Object.assign({}, driver(state)); }; -exports.murderRobot = name => { +export const murderRobot = name => { //Escribe aquí tu código }; -exports.murderDog = name => { +export const murderDog = name => { //Escribe aquí tu código }; -exports.murderRobotDog = name => { +export const murderRobotDog = name => { //Escribe aquí tu código }; diff --git a/topics/paradigms/06-composition/05-exercises/09-composition/solution/composition.js b/topics/paradigms/06-composition/05-exercises/09-composition/solution/composition.js index 936d1e74f..2c3cad8db 100644 --- a/topics/paradigms/06-composition/05-exercises/09-composition/solution/composition.js +++ b/topics/paradigms/06-composition/05-exercises/09-composition/solution/composition.js @@ -32,7 +32,7 @@ const robot = name => { return Object.assign({}, driver(state)); }; -exports.murderRobot = name => { +export const murderRobot = name => { const state = { name: name, speed: 100, @@ -41,7 +41,7 @@ exports.murderRobot = name => { return Object.assign({}, driver(state), killer(state)); }; -exports.murderDog = name => { +export const murderDog = name => { const state = { name: name, speed: 100, @@ -50,7 +50,7 @@ exports.murderDog = name => { return Object.assign({}, barker(state), pooper(state), killer(state)); }; -exports.murderRobotDog = name => { +export const murderRobotDog = name => { const state = { name: name, speed: 100, diff --git a/topics/paradigms/06-composition/05-exercises/09-composition/test/composition.spec.js b/topics/paradigms/06-composition/05-exercises/09-composition/test/composition.spec.js index d86fe888f..e0f4c8842 100644 --- a/topics/paradigms/06-composition/05-exercises/09-composition/test/composition.spec.js +++ b/topics/paradigms/06-composition/05-exercises/09-composition/test/composition.spec.js @@ -1,5 +1,5 @@ -const Assert = require('chai').assert; -const Submission = require('../solution/composition'); +import { assert } from 'chai'; +import * as Submission from '../solution/composition.js'; describe('Object composition', () => { @@ -7,15 +7,15 @@ describe('Object composition', () => { describe('murderDog()', () => { it('debería ser una función', () => { - Assert.equal(typeof Submission.murderDog, 'function'); + assert.equal(typeof Submission.murderDog, 'function'); }); it('debería retornar un objeto con bark, poop y kill', () => { const obj = Submission.murderDog(); - Assert.deepEqual(Object.keys(obj), ['bark', 'poop', 'kill']); - Assert.equal(typeof obj.bark, 'function'); - Assert.equal(typeof obj.poop, 'function'); - Assert.equal(typeof obj.kill, 'function'); + assert.deepEqual(Object.keys(obj), ['bark', 'poop', 'kill']); + assert.equal(typeof obj.bark, 'function'); + assert.equal(typeof obj.poop, 'function'); + assert.equal(typeof obj.kill, 'function'); }); }); @@ -23,14 +23,14 @@ describe('Object composition', () => { describe('murderRobot()', () => { it('debería ser una función', () => { - Assert.equal(typeof Submission.murderRobot, 'function'); + assert.equal(typeof Submission.murderRobot, 'function'); }); it('debería retornar un objeto con drive y kill', () => { const obj = Submission.murderRobot(); - Assert.deepEqual(Object.keys(obj), ['drive', 'kill']); - Assert.equal(typeof obj.drive, 'function'); - Assert.equal(typeof obj.kill, 'function'); + assert.deepEqual(Object.keys(obj), ['drive', 'kill']); + assert.equal(typeof obj.drive, 'function'); + assert.equal(typeof obj.kill, 'function'); }); }); @@ -38,15 +38,15 @@ describe('Object composition', () => { describe('murderRobotDog()', () => { it('debería ser una función', () => { - Assert.equal(typeof Submission.murderRobotDog, 'function'); + assert.equal(typeof Submission.murderRobotDog, 'function'); }); it('debería retornar un objeto con bark, drive y kill', () => { const obj = Submission.murderRobotDog(); - Assert.deepEqual(Object.keys(obj), ['bark', 'drive', 'kill']); - Assert.equal(typeof obj.bark, 'function'); - Assert.equal(typeof obj.drive, 'function'); - Assert.equal(typeof obj.kill, 'function'); + assert.deepEqual(Object.keys(obj), ['bark', 'drive', 'kill']); + assert.equal(typeof obj.bark, 'function'); + assert.equal(typeof obj.drive, 'function'); + assert.equal(typeof obj.kill, 'function'); }); });