adding tests for generateRndKey (#2932)
changing jest.config.js
transform option from -
transform: { '^.+\\.ts?$': 'ts-jest' },
to
transform: { '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }], },
This commit is contained in:
@@ -34,12 +34,11 @@ const saveKeys = async (keys, setError) => {
|
||||
setError(error);
|
||||
}
|
||||
};
|
||||
|
||||
const generateRndKey = () => {
|
||||
export const generateRndKey = () => {
|
||||
let defaultKey = '';
|
||||
let isValidStreamKey = false;
|
||||
const streamKeyRegex = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#$%^&*]).{8,192}$/;
|
||||
const s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*';
|
||||
const streamKeyRegex = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#$^&*]).{8,192}$/;
|
||||
const s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$^&*';
|
||||
|
||||
while (!isValidStreamKey) {
|
||||
const temp = Array.apply(20, Array(30))
|
||||
|
||||
Reference in New Issue
Block a user