Other technologies Flashcards
Jest
describe(“FizzBuzz”, () => {
test(‘[3] should result in “fizz”’, () => {
expect(fizz_buzz([3])).toBe(‘fizz’);
});
test('[5] should result in "buzz"', () => { expect(fizz_buzz([5])).toBe('buzz'); }); });
beforeEach and afterEach: These hooks are executed before and after each test in the test suite.
beforeAll and afterAll: These hooks are executed just once for each test suite. i.e. if a test suite has 10 tests, then these hooks will just be executed once for every test execution.
middleware (Thunk / Saga)
Redux Thunk is a middleware that lets you call action creators that return a function instead of an action object.
That function receives the store’s dispatch method, which is then used to dispatch regular synchronous actions inside the function’s body once the asynchronous operations have been completed.
(Saga works like a separate thread or a background process that is solely responsible for making your side effects or API calls unlike redux-thunk, which uses callbacks which may lead to situations like ‘callback hell’ in some cases. However, with the async/await system, this problem can be minimized in redux-thunk.)
Mongo DB
fetch keyword:
findOneListingByName