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
| module.exports = { | |
| async redirects() { | |
| return [ | |
| { | |
| source: '/about', | |
| destination: '/', | |
| permanent: 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
| module.exports = { | |
| async rewrites() { | |
| return [ | |
| { | |
| source: '/backend/:path*', | |
| destination: 'https://example.com/:path*', | |
| } | |
| ] | |
| } | |
| } |
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 { GetStaticProps } from 'next'; | |
| type Props = { | |
| data: string, | |
| }; | |
| export const getStaticProps: GetStaticProps = async (context): Props => { | |
| console.log('in getStaticProps...'); | |
| return { |
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 bluebird from 'bluebird'; | |
| import uuid from 'react-uuid'; | |
| import redis from 'redis'; | |
| const fetchData = async (url) => { | |
| console.log('fetching...'); | |
| const query = await fetch(url); | |
| return await query.json(); | |
| }; |
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 bluebird from 'bluebird'; | |
| import uuid from 'react-uuid'; | |
| import redis from 'redis'; | |
| const fetchData = async (url) => { | |
| console.log('fetching...'); | |
| const query = await fetch(url); | |
| return await query.json(); | |
| }; |
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 uuid from 'react-uuid'; | |
| const fetchData = async (url) => { | |
| const query = await fetch(url); | |
| return await query.json(); | |
| }; | |
| export const getStaticProps = async () => { | |
| const data = await fetchData('https://www.healthcare.gov/api/articles.json'); |
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
| class Account(): | |
| __balance = 0 | |
| def __init__(self, initialBalance): | |
| self.__balance = initialBalance | |
| def get_balance(self): | |
| return self.__balance | |
| def update_balance(self, amount): |
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
| # more imports | |
| from unittest.mock import MagicMock | |
| # more tests | |
| def test_withdraw_has_balance_mock(self): | |
| # setup | |
| withdrawalAmount = 75 | |
| self.account.update_balance = MagicMock() |
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
| def test_withdraw_has_balance_stub(self): | |
| # setup | |
| withdrawalAmount = 40 | |
| def stub(): | |
| return 60 | |
| original_get_balance = self.account.get_balance |
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 unittest | |
| from account import Account | |
| class TestAccount(unittest.TestCase): | |
| def setUp(self): | |
| self.account = Account(100) | |
| def test_withdraw_has_balance(self): |
NewerOlder