Skip to content

Commit

Permalink
fixed security hotspots and some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
uo288574 committed Apr 28, 2024
1 parent 24d9aeb commit c2fc32e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion webapp/src/components/FirstGame.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen, fireEvent } from '@testing-library/react';
import { ContextFun } from './Context';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { BrowserRouter as Router, useLocation } from 'react-router-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import FirstGame from './FirstGame';
import GameConfiguration from './game/GameConfiguration';

Expand Down
12 changes: 6 additions & 6 deletions webapp/src/components/Util.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { shuffleArray, secureRandomNumber } from './Util';
import axios from 'axios';

jest.mock('axios');

describe('shuffleArray function', () => {
// Mocking window.crypto.getRandomValues
beforeEach(() => {
const max = 100;
global.crypto = {
getRandomValues: jest.fn().mockImplementation((array) => {
for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 100); // Mocking random values
}
}),
getRandomValues: jest.fn().mockImplementation((array) => {
for (let i = 0; i < array.length; i++) {
array[i] = i;
}
}),
};
});

Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/game/Calculator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useState, useEffect } from 'react';
import React from 'react';
import { shuffleArray, secureRandomNumber } from '../Util';
import { Container, Typography, Box, LinearProgress} from '@mui/material';
import { Container, Typography } from '@mui/material';
import { Footer } from '../footer/Footer';
import { Nav } from '../nav/Nav';
import Button from '../Button';

var questions = []
var questionIndex = -1
let questions = []
let questionIndex = -1

const Calculator = () => {

Expand Down

0 comments on commit c2fc32e

Please sign in to comment.