Skip to content

Commit

Permalink
Speed up testing:url /konferanser/rediger?new=test gives a randomly p…
Browse files Browse the repository at this point in the history
…refilled test conference
  • Loading branch information
Espen Norderud committed Oct 5, 2023
1 parent 146fe9e commit cd4bf39
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/routes/konferanser/rediger/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import type {IToastContextProps} from "../../../components/toast/toast-context";
import NewPerformanceModal
from "../../../components/conference/NewConference/Page/PerformanceModal/NewPerformanceModal.svelte";
import {makeid} from "../../../utils/conference-utils";
const toastContext: IToastContextProps = getContext('toastContext');
function getUrlParamNew() {
Expand All @@ -30,7 +31,26 @@
let transferredData: NewConferenceStoreInitType;
const newconfkey = getUrlParamNew();
try {
if (typeof sessionStorage !== 'undefined') {
/** For faster testing, prefill some semi-random data by setting "?new=test" : */
if ("test" === newconfkey) {
transferredData = {
name: "Test: " + Math.floor(Math.random()*100000),
url: "miles.no",
selectedCategoryTags: ['Admin', 'AI'],
startDate: new Date(),
endDate: new Date(),
callForPapersDate: new Date(),
description: "Description randomness: \n\n" + Array.from(
{length: 80 + Math.floor(Math.random()*Math.random()*Math.random()*Math.random()*Math.random()*2000)},
() => 1 + Math.floor(Math.random() * Math.random() * Math.random() * 30)
)
.map(length => makeid(length).toLowerCase())
.join(" ")
,
location: "Oslo"
}
} else if ('undefined' !== typeof sessionStorage) {
if (newconfkey) {
const sessionStorageKey = `newconf_${newconfkey}`;
Expand Down

0 comments on commit cd4bf39

Please sign in to comment.