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 { FetchStatus } from '../models/fetch-status.enum'; | |
import { mockInitialRootState } from '../root/root-state.mock'; | |
import { countriesSelectors } from './countries.selectors'; | |
describe('Countries Selectors', () => { | |
describe('initial state', () => { | |
it('should return countries', () => { | |
const actual = countriesSelectors.getCountries(mockInitialRootState); | |
const expected = []; |
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 { renderHook } from '@testing-library/react-hooks'; | |
import { useFieldErrorTouched } from './use-field-errors-touched.hook'; | |
jest.mock('formik', () => ({ | |
useFormikContext: () => { | |
return { | |
touched: { fieldName: true }, | |
errors: { fieldName: 'random error' }, | |
isSubmitting: 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 { Action } from '@reduxjs/toolkit'; | |
import { | |
countriesService, | |
mockCountriesResponse, | |
} from '@white-label-airline/services/countries'; | |
import { ActionsObservable } from 'redux-observable'; | |
import { of } from 'rxjs'; | |
import { getCountriesEpic } from './countries.epics'; | |
import { countriesSlice } from './countries.slice'; |
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 { Dispatch } from '@reduxjs/toolkit'; | |
export const mapStateToProps = (state: RootStateInterface) => { | |
return ... | |
}; | |
export const mapDispatchToProps = (dispatch: Dispatch) => { | |
return ... | |
}; |
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
export enum FeatureName { | |
ShowCountry = 'ShowCountry', | |
ShowCurrency = 'ShowCurrency', | |
} |
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 i18n from 'i18next'; | |
import LanguageDetector from 'i18next-browser-languagedetector'; | |
import HttpApi from 'i18next-http-backend'; | |
import { initReactI18next } from 'react-i18next'; | |
declare const process; | |
function initI18n(loadPath: string, defaultLanguage: string) { | |
return i18n | |
.use(LanguageDetector) |
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 { | |
Localization, | |
zhCN as materialZhCN, | |
enUS as materialEnUS, | |
} from '@material-ui/core/locale'; | |
import { onLanguageChanged } from '@white-label-airline/services/i18n'; | |
import { zhCN as dateZhCN, enGB as dateEnGB } from 'date-fns/locale'; | |
import { useEffect, useState } from 'react'; | |
const useLocale = () => { |
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 { WlaRootState } from '../root'; | |
const getLanguage = (state: WlaRootState): string => { | |
return state.language; | |
}; | |
export const languageSelectors = { getLanguage }; |
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 * as admin from 'firebase-admin'; | |
import * as functions from 'firebase-functions'; | |
admin.initializeApp(); | |
const database = admin.firestore(); | |
function updateLikesDislikesCountOnPost( | |
change: functions.Change<FirebaseFirestore.DocumentSnapshot>, | |
collectionName: 'likes' | 'dislikes' |
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
// Query all blog posts, display title and excerpt for each blog. | |
import { graphql } from 'gatsby'; | |
import React from 'react'; | |
export interface BlogPostArchiveProps { | |
data: { | |
allWpPost: { | |
nodes: { | |
id: string; | |
title: string; |