Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/src/common/ut_metadataparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TEST_F(UT_MetaDataParser, UT_MetaDataParser_makeMetaData_001)
metadataparser.parse(metadata, noteData);
metadata = "";
metadataparser.makeMetaData(noteData, metadata);
EXPECT_EQ("{\"dataCount\":1,\"noteDatas\":[{\"text\":\"sdfgsgssrgstg\",\"type\":1}],\"voiceMaxId\":0}", metadata) << "htmlCode is empty";
EXPECT_EQ(QByteArrayLiteral("{\"dataCount\":1,\"noteDatas\":[{\"text\":\"sdfgsgssrgstg\",\"type\":1}],\"voiceMaxId\":0}"), metadata.toByteArray()) << "htmlCode is empty";

noteData->htmlCode = "abc";
metadataparser.makeMetaData(noteData, metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ TEST(UT_MigrationJsonBuilder, GeneratedEnvelopePassesSchemaValidator)
const QString path = writeTempEnvelope(envelope);
QProcess validator;
validator.setWorkingDirectory(findRepoRoot());
validator.start(QStringLiteral("node"), { QStringLiteral("web-editor/scripts/validate-envelope.mjs"), path });
validator.start(QStringLiteral("node"), { QStringLiteral("--import"), QStringLiteral("./web-editor/scripts/css-inline-loader.mjs"), QStringLiteral("web-editor/scripts/validate-envelope.mjs"), path });
ASSERT_TRUE(validator.waitForFinished(30000));
EXPECT_EQ(0, validator.exitCode()) << validator.readAllStandardError().toStdString();
QFile::remove(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void expectPassesValidators(const QJsonObject &envelope)

QProcess validator;
validator.setWorkingDirectory(repoRoot);
validator.start(QStringLiteral("node"), { QStringLiteral("web-editor/scripts/validate-envelope.mjs"), envelopeFile.fileName() });
validator.start(QStringLiteral("node"), { QStringLiteral("--import"), QStringLiteral("./web-editor/scripts/css-inline-loader.mjs"), QStringLiteral("web-editor/scripts/validate-envelope.mjs"), envelopeFile.fileName() });
ASSERT_TRUE(validator.waitForFinished(30000));
EXPECT_EQ(0, validator.exitCode()) << validator.readAllStandardError().toStdString();
}
Expand Down
5 changes: 4 additions & 1 deletion tests/src/task/ut_exportnoteworker.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "ut_exportnoteworker.h"
#include "task/exportnoteworker.h"
#include "common/vnotedatamanager.h"
#include "common/vnoteitem.h"

Check warning on line 8 in tests/src/task/ut_exportnoteworker.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "common/vnoteitem.h" not found.

#include <QApplication>

Check warning on line 10 in tests/src/task/ut_exportnoteworker.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDir>

Check warning on line 11 in tests/src/task/ut_exportnoteworker.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDir> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QList>

Check warning on line 12 in tests/src/task/ut_exportnoteworker.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QList> not found. Please note: Cppcheck does not need standard library headers to get proper results.

void UT_ExportNoteWorker::SetUp()
{
QDir().mkpath(QStringLiteral("test"));
VNOTE_ALL_NOTES_MAP *notes = VNoteDataManager::instance()->getAllNotesInFolder();
if (notes && !notes->notes.isEmpty()) {
VNOTE_ITEMS_MAP *tmp = notes->notes.first();
Expand All @@ -33,6 +35,7 @@
void UT_ExportNoteWorker::TearDown()
{
delete note;
QDir("test").removeRecursively();
}

UT_ExportNoteWorker::UT_ExportNoteWorker()
Expand Down
12 changes: 12 additions & 0 deletions web-editor/scripts/css-inline-loader.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

// Entry module for `node --import`: registers the CSS loader hook below so
// that validate-envelope.mjs can import create-schema.js (which transitively
// imports voice-block.css?inline) without a bundler.
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';

const hookURL = new URL('./css-loader-hook.mjs', import.meta.url);
register(pathToFileURL(hookURL.pathname));
17 changes: 17 additions & 0 deletions web-editor/scripts/css-loader-hook.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

// ESM loader hook: intercepts Vite-style CSS inline imports so that the
// validator can run under plain Node.js (no bundler). Returns an empty
// string for the CSS module default export.
export async function load(url, context, nextLoad) {
if (url.includes('.css')) {
return {
format: 'module',
source: 'export default ""',
shortCircuit: true,
};
}
return nextLoad(url, context);
}
Loading