This file contains 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 fs = require('fs'); | |
const mkdirp = require('mkdirp'); | |
const getDirName = require('path').dirname; | |
const axios = require('axios'); | |
const styleguideId = process.argv.slice(2)[0]; // provide styleguideId ast 1st arg in command line | |
if (!styleguideId) { | |
throw Error('Please provide styleguideId as first arg'); | |
} |
This file contains 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
<script> | |
function recursivelyRemoveFill(el) { | |
if (!el) { | |
return; | |
} | |
el.removeAttribute('fill'); | |
[].forEach.call(el.children, child => { | |
recursivelyRemoveFill(child); | |
}); | |
} |
This file contains 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
beforeEach(() => { | |
// do something | |
}); | |
describe('1st block', () => { | |
test('1st test', () => {}); | |
describe('2nd block', () => { | |
beforeEach(() => { | |
// do something again | |
}); |
This file contains 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
test('emit events when keydown.a pressed', () => { | |
wrapper.trigger('keydown', { | |
key: 'a' | |
}); | |
expect(wrapper.emitted().aPressed.length).toBe(1); | |
}); |
This file contains 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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: cyan; icon-glyph: swimmer; | |
// Checks surf height at Pacifica Lindmar beach | |
// Using Surfline's services API | |
const baseUrl = "https://services.surfline.com/kbyg/spots/forecasts" | |
const paramsList = [ | |
{ | |
type: 'wave', | |
query: [ |
This file contains 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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: cyan; icon-glyph: swimmer; | |
// Checks surf height at Pacifica Lindmar beach | |
const url = "https://www.surfline.com/surf-report/pacifica-lindamar/5842041f4e65fad6a7708976" | |
const webview = new WebView() | |
await webview.loadURL(url) | |
var getData = ` |
This file contains 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
test('check async block', async() => { | |
await wrapper.vm.asyncFunction(); // where asyncFunction() has a resolved Promise or other async stuff | |
}); |
This file contains 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
// used in component | |
<script> | |
import Constants from '../constants'; | |
console.log(Constants.myConstant); | |
</script> | |
// in test file | |
jest.mock('../constants', () => ({ | |
'myConstant': 'myValue', |
This file contains 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 jest.fn() to mock action and mutation functions | |
beforeEach(() => { | |
actions = { | |
someAction: jest.fn(() => true) | |
}; | |
mutations = { | |
someMutation: jest.fn(() => false) | |
}; | |
state = { | |
key: {} |
This file contains 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
let wrapper; | |
const factory = (computed = {}) => { | |
return shallowMount(Component, { | |
propsData: {}, | |
mocks: {}, | |
stubs: {}, | |
methods: {}, | |
computed, | |
}); | |
}; |
NewerOlder