test: adjust karma global state mock

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/53326/head
Ferdinand Thiessen 4 months ago
parent a388e2b55b
commit ad838b21a1
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
  1. 7
      core/js/tests/specHelper.js
  2. 12
      tests/karma.config.js

@ -85,6 +85,9 @@ window._oc_appswebroots = {
"files": window.webroot + '/apps/files/',
"files_sharing": window.webroot + '/apps/files_sharing/'
};
window.OC ??= {};
OC.config = {
session_lifetime: 600 * 1000,
session_keepalive: false,
@ -111,6 +114,10 @@ window.Snap.prototype = {
window.isPhantom = /phantom/i.test(navigator.userAgent);
document.documentElement.lang = navigator.language;
const el = document.createElement('input');
el.id = 'initial-state-core-config';
el.value = btoa(JSON.stringify(window.OC.config))
document.body.append(el);
// global setup for all tests
(function setupTests() {

@ -18,8 +18,6 @@
* preprocessor, which is needed to be able to debug tests properly in a browser.
*/
const { existsSync } = require('node:fs');
if (!process.env.CHROMIUM_BIN) {
const chrome = require('puppeteer').executablePath()
process.env.CHROMIUM_BIN = chrome
@ -42,7 +40,10 @@ module.exports = function(config) {
// are specified in a separate file
var corePath = 'dist/';
var coreModule = require('../core/js/core.json');
var files = [];
var files = [
// core mocks
'core/js/tests/specHelper.js',
];
var preprocessors = {};
var srcFile, i;
@ -58,9 +59,6 @@ module.exports = function(config) {
files.push('dist/core-files_client.js');
files.push('dist/core-systemtags.js');
// core mocks
files.push('core/js/tests/specHelper.js');
// add core modules files
for (i = 0; i < coreModule.modules.length; i++) {
srcFile = corePath + coreModule.modules[i];
@ -106,7 +104,7 @@ module.exports = function(config) {
frameworks: ['jasmine', 'jasmine-sinon', 'viewport'],
// list of files / patterns to load in the browser
files: files,
files,
// list of files to exclude
exclude: [],

Loading…
Cancel
Save