Add config fallback for legacy tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-04-21 09:47:05 +02:00
parent 9e7f8b85dd
commit 84330f1d36
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 8 additions and 1 deletions

View File

@ -25,9 +25,16 @@ import { loadState } from '@nextcloud/initial-state'
import { getCurrentUser } from '@nextcloud/auth'
import { generateUrl } from './OC/routing'
import OC from './OC'
import { setToken as setRequestToken, getToken as getRequestToken } from './OC/requesttoken'
const config = loadState('core', 'config')
let config
try {
config = loadState('core', 'config')
} catch (e) {
// This fallback is just for our legacy jsunit tests since we have no way to mock loadState calls
config = OC.config
}
/**
* session heartbeat (defaults to enabled)