Skip to content
Snippets Groups Projects
Commit b1f269a4 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

wip(ts) Add compatibility to NodeJS 18 (e.g. Promise<void>)

parent ab559549
Branches
Tags
No related merge requests found
......@@ -12,7 +12,7 @@ export function arrayPruneAll<T>(array: T[], value: T) {
}
/**
* Returs a copy of given array WITHOUT any record of `value`.
* Return a copy of given array WITHOUT any record of `value`.
* @param original The array we want records, with `value` being excluded.
* @param value The value we don't want to see in our copy array.
*/
......
......@@ -11,7 +11,6 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
import { DEFAULT_ENCODING } from "crypto";
import {WS2PServer} from "./WS2PServer";
import {Server} from "../../../../server";
import {WS2PClient} from "./WS2PClient";
......@@ -37,7 +36,6 @@ import { NewLogger } from "../../../lib/logger";
const es = require("event-stream");
const nuuid = require("node-uuid");
const logger = NewLogger();
export interface WS2PHead {
message: string;
......
......@@ -120,9 +120,11 @@ describe("Triming", function(){
{ op: 'CREATE', identifier: 'SOURCE_1', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'COND(SOURCE_1)'},
{ op: 'UPDATE', identifier: 'SOURCE_1', pos: 4, written_on: '139-H', writtenOn: 139, written_time: 4500, consumed: true, conditions: 'COND(SOURCE_1)'},
{ op: 'CREATE', identifier: 'SOURCE_2', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'COND(SOURCE_2)'},
{ op: 'CREATE', identifier: 'SOURCE_3', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'COND(SOURCE_3)'}
{ op: 'CREATE', identifier: 'SOURCE_3', pos: 4, written_on: '126-H', writtenOn: 126, written_time: 2000, consumed: false, conditions: 'SIG(PUB_1)'}
] as any);
(await dal.sindexDAL.findByIdentifier('SOURCE_1')).should.have.length(2);
(await dal.sindexDAL.getAvailableForConditions('COND(SOURCE_2)')).should.have.length(1);
(await dal.sindexDAL.getAvailableForPubkey('PUB_1')).should.have.length(1);
(await dal.sindexDAL.findByPos(4)).should.have.length(4);
})
......@@ -130,6 +132,8 @@ describe("Triming", function(){
// Triming
await dal.trimIndexes(140);
(await dal.sindexDAL.findByIdentifier('SOURCE_1')).should.have.length(0);
(await dal.sindexDAL.getAvailableForConditions('COND(SOURCE_1)')).should.have.length(0);
(await dal.sindexDAL.getAvailableForPubkey('PUB_1')).should.have.length(1);
(await dal.sindexDAL.findByPos(4)).should.have.length(2);
})
......
......@@ -59,7 +59,7 @@ describe('Import/Export', () => {
const archive = await s1.exportAllDataAsZIP();
const output = require('fs').createWriteStream(s1.home + '/export.zip');
archive.pipe(output);
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
archive.on('error', reject);
output.on('close', function() {
resolve();
......
......@@ -90,7 +90,7 @@ describe("Peer document expiry", function() {
it('routing V1 peer document should raise an "outdated" event', async () => {
const caster = new Multicaster();
return new Promise((resolve) => {
return new Promise<void>((resolve) => {
caster
.pipe(es.mapSync((obj:any) => {
obj.should.have.property("outdated").equal(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment