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
@given('the ninja has a {achievement_level}') | |
def step_the_ninja_has_a(context, achievement_level): | |
context.ninja_fight = NinjaFight(achievement_level) | |
@when('attacked by a {opponent_role}') | |
def step_attacked_by_a(context, opponent_role): | |
context.ninja_fight.opponent = opponent_role | |
@when('attacked by {opponent}') | |
def step_attacked_by(context, opponent): |
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
describe('TaskStack', function(){ | |
describe('#add()', function(){ | |
it('must have one element', function(){ | |
const task = new Task(); | |
const taskStack = new TaskStack(); | |
taskStack.add(task); | |
taskStack.should.have.length(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
#To install the Jest test runner and the Vue Test Utils tool | |
npm install --save-dev jest @vue/test-utils | |
#To allow Jest to know how to work with SFC (Single File Components) | |
npm install --save-dev vue-jest | |
#To allow write Jest tests with the latests EcmaScript versions | |
npm install --save-dev babel-jest |
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
{ | |
"_comment": "Many Project INFO goes here...", | |
"scripts": { | |
"_comment": "Many scripts goes here...", | |
"test": "jest" | |
}, | |
"dependencies": { | |
"_comment": "Many dependencies goes here...", | |
}, |
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
import { shallow } from 'vue-test-utils'; | |
import ServicePage from '@/components/Service'; | |
const axios = { | |
get: (url) => { | |
if (url === '/') { | |
return Promise.resolve({ | |
data: [ | |
{ name: 'Ramon', status: 'true' }, | |
{ name: 'Rodrigo', status: 'true' }, |
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
import { mount } from 'vue-test-utils'; | |
import ServicePage from '@/components/Service'; | |
describe('ServicePage', () => { | |
it('should show the state from service', () => { | |
const servicePage = mount(ServicePage); | |
expect(servicePage.contains('.service__list')).toBe(true); | |
}); | |
}); |
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
<template> | |
<ul class="service__list"> | |
<li></li> | |
</ul> | |
</template> | |
<script> | |
export default { | |
name: 'service-page', | |
data() { |
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
import { mount } from 'vue-test-utils'; | |
import ServicePage from '@/components/Service'; | |
describe('ServicePage', () => { | |
it('should show the state from service', () => { | |
const servicePage = mount(ServicePage); | |
expect(servicePage.find('.service__list-item-status').text()).toBe('true'); | |
}); | |
it('should show the name from service', () => { |
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
<template> | |
<ul class="service__list"> | |
<li v-for="(service, index) in services" :key="index" | |
class="service__list-item"> | |
<span class="service__list-item-status">{{ service.status }}</span> | |
<span class="service__list-item-name">{{ service.name }}</span> | |
</li> | |
</ul> | |
</template> |
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
import { mount } from 'vue-test-utils'; | |
import ServicePage from '@/components/Service'; | |
describe('ServicePage', () => { | |
it('should show the name and the service state', () => { | |
const servicePage = mount(ServicePage); | |
expect(servicePage.find('.service__list-item-status').text()).toBe('true'); | |
expect(servicePage.find('.service__list-item-name').text()).toBe('Ramon'); | |
}); | |
}); |
OlderNewer