🎥 Make videos programmatically with React
test getInputProps()
Calvin Falter8e4c2eccb284
diff --git a/packages/core/src/test/input-props.test.ts b/packages/core/src/test/input-props.test.tsnew file mode 100644index 0000000000..98f9579bdc--- /dev/null+++ b/packages/core/src/test/input-props.test.ts@@ -0,0 +1,46 @@+import {getInputProps, INPUT_PROPS_KEY} from '../config/input-props';++describe('input props', () => {+ const OLD_ENV = process.env;++ beforeEach(() => {+ jest.resetModules(); // Most important - it clears the cache+ process.env = {...OLD_ENV}; // Make a copy+ });++ afterAll(() => {+ process.env = OLD_ENV; // Restore old environment+ });++ test('input props in non production env', () => {+ process.env.NODE_ENV = 'dev';+ const inputProps = {+ firstProperty: 'firstProperty',+ secondProperty: 'secondProperty',+ };+ process.env.INPUT_PROPS = JSON.stringify(inputProps);++ expect(getInputProps()).toEqual(JSON.stringify(inputProps));+ });++ test('input props in production env', () => {+ process.env.NODE_ENV = 'production';+ const inputProps = {+ firstProperty: 'firstProperty',+ secondProperty: 'secondProperty',+ };+ const previousInputProps = localStorage.getItem(INPUT_PROPS_KEY);+ localStorage.setItem(INPUT_PROPS_KEY, JSON.stringify(inputProps));++ expect(getInputProps()).toEqual(inputProps);++ if (previousInputProps)+ localStorage.setItem(INPUT_PROPS_KEY, previousInputProps);+ else localStorage.removeItem(INPUT_PROPS_KEY);+ });++ test('input props in production env - empty localstorage', () => {+ process.env.NODE_ENV = 'production';+ expect(getInputProps()).toEqual({});+ });+});