Descripción | Assert o TDD | BDD |
---|---|---|
Define una suite de tests | suite | describe o context |
Se ejecuta una vez antes de todos los tests de una suite | suiteSetup | before |
Se ejecuta una vez después de todos los tests de una suite | suiteTeardown | after |
Se ejecuta antes de cada test de una suite | setup | beforeEach |
Se ejecuta después de cada test de una suite | teardown | afterEach |
Test | test | it |
Assert * | assert | expect o should |
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
{ | |
"lint": { | |
"rules": [ | |
"polymer-3" | |
] | |
}, | |
"entrypoint": "demo/index.html", | |
"extraDependencies": [ | |
"your-component.js" | |
], |
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
{ | |
"name": "@myscope/mypackage", | |
"main": "mypackage.js", | |
"version": "0.0.0", | |
"dependencies": { | |
"@polymer/lit-element": "^0.6.5" | |
}, | |
"devDependencies": { | |
"@webcomponents/webcomponentsjs": "^2.2.0", | |
"polymer-cli": "^1.9.4", |
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
language: node_js | |
node_js: "8" | |
cache: npm | |
script: npm run build -- -prod | |
deploy: | |
provider: pages |
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
{ | |
"name": "demo-project", | |
"version": "0.0.0", | |
"scripts": { | |
"build": "sampleframework build", | |
"start": "sampleframework serve", | |
"test": "sampleframework test" | |
}, | |
"devDependencies": { | |
"sampleframework-cli": "~3.5.0" |
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
test('Example using spy', () => { | |
const spy = sinon.spy(sut, 'doSomething'); | |
sut.doSomething(); | |
assert.isTrue(spy.called); | |
}); |
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
test('Example using stub', () => { | |
const stub = sinon.stub(sut, 'doSomething'); | |
sut.doSomething(); | |
assert.isTrue(stub.called); | |
}); |
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
suite('<my-modal>', () => { | |
suite('setting "opened" as true', () => { | |
// fixture instancia el componente | |
const sut = fixture('someId'); | |
// Se ejecuta una vez antes de todos los tests de este bloque | |
suiteSetup(() => { | |
sut.opened = true; | |
}); |
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
describe('<my-modal>', () => { | |
// context es un alias de describe | |
context('setting "opened" as true', () => { | |
// fixture instancia el componente | |
const sut = fixture('someId'); | |
// Se ejecuta una vez antes de todos los tests de este bloque | |
before(() => { | |
sut.opened = true; | |
}); |
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
test('setting "opened" as true opens the modal', () => { | |
// Act | |
sut.opened = true; | |
// Assert | |
assert.isTrue(isVisilble(sut)); | |
}); |