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
export const fetch = async () => { | |
return await axios.get('/users') | |
} |
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
export const fetchUsers = async () => { | |
return await axios.get('/users') | |
} |
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
// Find student from lists, with the given id | |
const student = students.find(s => s.id === id) |
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
// Calculate tax based on the income and wealth value and .... | |
const income = document.getElementById('income').value; | |
const wealth = document.getElementById('wealth').value; | |
tax.value = (0.15 * income) + (0.25 * wealth); | |
// ... |
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 calculateTax(income, wealth) { | |
return (0.15 * income) + (0.25 * wealth); | |
} |
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
export const getAnimal = (code) => { | |
if (code === 1) return 'CATS' | |
if (code === 2) return 'DOGS' | |
if (code === 3) return 'RABBITS' | |
return null | |
} |
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
import { getAnimal } from './util'; | |
describe('getAnimal', () => { | |
it('passes', () => { | |
expect(getAnimal(1)).toEqual('CATS') | |
}) | |
}) |
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('getAnimal', () => { | |
it('should get CATS when passing code 1', () => { | |
expect(getAnimal(1)).toEqual('CATS') | |
}) | |
}) |
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('getAnimal', () => { | |
context('when passing code 1', () => { | |
it('should get CATS', () => { | |
expect(getAnimal(1)).toEqual('CATS') | |
}) | |
}) | |
}) |
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('getAnimal', () => { | |
context('when passing code 1', () => { | |
beforeEach(() => { | |
// arrange | |
// prepare data here | |
}) | |
it('should get CATS', () => { | |
// act | |
const result = getAnimal(1) |