BlocknoteJS requires an ESM module where our server is CJS, this forced us to pin the server-util version, which led us to force the resolution of several packages, leading to bugs downstream. From Node 22.12 Node supports requiring ESM modules (available from Node 22.0 with a flag). So I upgrade the module. I picked Node 22 and not Node 23 or Node 24 because 22 is the LTS and we don't plan to change node versions frequently. If you remain on Node 18, things should still mostly work, except if you edit a Rich Text field. I also starting changing the default runtime for Serverless Functions which isn't directly related. This means new serverless functions will be created on Node 22, but we will still need another PR to migrate existing serverless functions before September (end of support by AWS). (In this PR I also remove the upgrade commands from 0.43 since they rely on Blocknote and I didn't want to have to deal with this) --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { logDebug } from '../logDebug';
|
|
|
|
describe('logDebug', () => {
|
|
let consoleDebugSpy: jest.SpyInstance;
|
|
|
|
beforeEach(() => {
|
|
consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(() => {});
|
|
});
|
|
|
|
afterEach(() => {
|
|
consoleDebugSpy.mockRestore();
|
|
});
|
|
|
|
it('should call console.debug with the provided message', () => {
|
|
const debugMessage = 'Test debug message';
|
|
|
|
logDebug(debugMessage);
|
|
|
|
expect(consoleDebugSpy).toHaveBeenCalledWith(debugMessage, []);
|
|
expect(consoleDebugSpy).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
it('should handle optional parameters', () => {
|
|
const debugMessage = 'Test debug message';
|
|
const param1 = 'param1';
|
|
const param2 = { key: 'value' };
|
|
|
|
logDebug(debugMessage, param1, param2);
|
|
|
|
expect(consoleDebugSpy).toHaveBeenCalledWith(debugMessage, [
|
|
param1,
|
|
param2,
|
|
]);
|
|
});
|
|
|
|
it('should handle no optional parameters', () => {
|
|
const debugMessage = 'Test debug message';
|
|
|
|
logDebug(debugMessage);
|
|
|
|
expect(consoleDebugSpy).toHaveBeenCalledWith(debugMessage, []);
|
|
});
|
|
|
|
it('should handle null and undefined messages', () => {
|
|
logDebug(null);
|
|
expect(consoleDebugSpy).toHaveBeenCalledWith(null, []);
|
|
|
|
logDebug(undefined);
|
|
expect(consoleDebugSpy).toHaveBeenCalledWith(undefined, []);
|
|
});
|
|
});
|