This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/xjamundx/eslint-plugin-promise |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using stubs | |
import { shallowMount } from '@vue/test-utils' | |
import LmPagination from '@/components/LmPagination.vue' | |
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | |
describe('LmPagination', () => { | |
const wrapper = shallowMount(LmPagination, { | |
propsData: { | |
allRegistries: 300, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 - sudo vue add @vue/unit-jest | |
2 - Clear Jest cache. You can find the cache location by running `jest --showConfig`. Look for `cacheDirectory` key. Its value is the name of the folder you'll need to remove. | |
3 - Create test files into project_name/tests/unit/. file must have this structure name.spec.js for example /home/pablo/projects/lumbre/lumbre-vue-admin/tests/unit/LmPagination.spec.js | |
4 - In the terminal yarn test:unit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function User (name,age) { | |
this.name = name, | |
this.age = age | |
} | |
var user1 = new User('Pablo', 36) | |
var user2 = new User('Victoria', 34) | |
User.prototype.emailDomain = '@family.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.avoid-clicks { | |
pointer-events: none; | |
} | |
/* Example: https://davidwalsh.name/demo/pointer-events.php */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sass --watch input.scss output.css |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use('/images', express.static(path.join(__dirname, path_folder_storaging_images))) | |
// Example | |
const path = require('path') | |
app.use('/images', express.static(path.join(__dirname, 'images'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.collection('collectionName').findOne({key:value}) | |
// Example | |
const db = require('../db') | |
const ObjectId = require('mongodb').ObjectId | |
exports.getUser = ((req, res) => { | |
console.log('getUser') | |
filter = { | |
_id: new ObjectId(req.params.userId) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collectionName.find({ key:value }) | |
// Example: | |
db.usersToSendEmail.find({_id: ObjectId("5c405972f3d33522c6242d31")}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inventory = [ | |
{name: 'apples', quantity: 2}, | |
{name: 'bananas', quantity: 0}, | |
{name: 'cherries', quantity: 5} | |
]; | |
const result = inventory.find( fruit => fruit.name === 'cherries' ); | |
console.log(result) // { name: 'cherries', quantity: 5 } |