Convert test files to ESM (batch 1): apicalls, sessionsAndGroups, restoreRevision, instance, health, fuzzImportTest

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
SamTV12345 2026-04-26 14:05:13 +02:00
parent 22ad5364c7
commit 59ea987671
6 changed files with 45 additions and 13 deletions

View file

@ -1,3 +1,9 @@
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/*
* Fuzz testing the import endpoint
*/

View file

@ -1,11 +1,17 @@
'use strict';
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
/*
* Tests for the instance-level APIs
*
* Section "GLOBAL FUNCTIONS" in src/node/db/API.js
*/
const common = require('../../common');
import common from '../../common.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
let agent:any;
const apiVersion = '1.2.14';

View file

@ -1,11 +1,16 @@
'use strict';
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
import {PadType} from "../../../../node/types/PadType";
const assert = require('assert').strict;
const authorManager = require('../../../../node/db/AuthorManager');
const common = require('../../common');
const padManager = require('../../../../node/db/PadManager');
import assert from 'assert';
import authorManager from '../../../../node/db/AuthorManager.js';
import common from '../../common.js';
import padManager from '../../../../node/db/PadManager.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
describe(__filename, function () {
let agent:any;

View file

@ -1,11 +1,16 @@
'use strict';
import {agent, generateJWTToken, init, logger} from "../../common";
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
import {agent, generateJWTToken, init, logger} from "../../common.js";
import TestAgent from "supertest/lib/agent";
import supertest from "supertest";
const assert = require('assert').strict;
const db = require('../../../../node/db/DB');
import assert from 'assert';
import db from '../../../../node/db/DB.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
let apiVersion = 1;
let groupID = '';

View file

@ -1,6 +1,11 @@
'use strict';
const common = require('../common');
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
import common from '../common.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
describe(__filename, function () {
this.timeout(30000);

View file

@ -1,13 +1,18 @@
'use strict';
import {fileURLToPath} from 'node:url';
import {dirname} from 'node:path';
import {MapArrayType} from "../../../node/types/MapType";
const assert = require('assert').strict;
const common = require('../common');
import assert from 'assert';
import common from '../common.js';
import settings, {
getEpVersion
} from '../../../node/utils/Settings';
const superagent = require('superagent');
} from '../../../node/utils/Settings.js';
import superagent from 'superagent';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
describe(__filename, function () {
let agent:any;