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
21 changes: 5 additions & 16 deletions test/Ported/CustomEntityName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ import { assertThat } from "../Utils/AssertExtensions.js";

describe("CustomEntityName", function () {

const getChars = () => {
const basicChars = [...new Array(31).keys()].map(x => {
return String.fromCodePoint(x + 1);
});

const extraChars = [ "a", "-", "'", "\"", "\\", "\b", "\f", "\n", "\r", "\t" ];

return [...basicChars, ...extraChars];
};

const getCharactersToTestWithSpecial = () => {
const basicChars = getChars();
// RavenDB-25738: the server rejects control characters in a collection name
// unconditionally (the SupportedFeatures opt-out only relaxes document IDs).
// These chars are therefore everything the server allows in a collection name
// and match the C# CustomEntityName test's GetChars().
const basicChars = [ "a", "-", "'", "\"", "\\", "\b", "\f", "\n", "\r", "\t" ];
const specialChars = [ "Ā", "Ȁ", "Ѐ", "Ԁ", "؀", "܀", "ऀ", "ਅ", "ଈ", "అ", "ഊ", "ข", "ဉ", "ᄍ", "ሎ", "ጇ", "ᐌ", "ᔎ", "ᘀ", "ᜩ", "ᢹ", "ᥤ", "ᨇ" ];
return [...basicChars, ...specialChars];
}
Expand All @@ -29,11 +23,6 @@ describe("CustomEntityName", function () {

const store = await testContext.getDocumentStore();
try {

if (c.charCodeAt(0) >= 14 && c.charCodeAt(0) <= 31) {
return;
}

{
const session = store.openSession();
const car = new Car();
Expand Down
4 changes: 2 additions & 2 deletions test/Ported/HttpsTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from "node:assert"
import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil.js";
import {testContext, disposeTestDocumentStore, RavenTestContext} from "../Utils/TestUtil.js";

import {
CertificateRawData,
Expand Down Expand Up @@ -280,7 +280,7 @@ async function extractCertificate(certificateRawData: CertificateRawData) {
if (entry.path.endsWith(".crt")) {
const entryText = await readToEnd(entry);
const lines = entryText.split(/\r?\n/);
cert = lines.slice(1, -1).join("\r\n");
cert = lines.slice(1, RavenTestContext.isRavenDbServerVersion("6.2") ? -1 : -2).join("\r\n");
break;
} else {
entry.autodrain();
Expand Down
2 changes: 1 addition & 1 deletion test/Ported/Issues/RavenDB_11440.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { throwError } from "../../../src/Exceptions/index.js";
import { TimeUtil } from "../../../src/Utility/TimeUtil.js";
import { assertThat } from "../../Utils/AssertExtensions.js";

(RavenTestContext.is70Server ? describe.skip : describe)("RavenDB_11440", function () {
(RavenTestContext.isRavenDbServerVersion("7.0") ? describe.skip : describe)("RavenDB_11440", function () {

let store: IDocumentStore;

Expand Down
4 changes: 4 additions & 0 deletions test/Ported/Issues/RavenDB_13478.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe("RavenDB_13478", function () {
let name = await store.subscriptions.create(options);

await assertSubscription(store, name, 0);
await store.subscriptions.delete(name);

options = {
includes: builder => builder.includeAllCounters(),
Expand All @@ -45,6 +46,7 @@ describe("RavenDB_13478", function () {
name = await store.subscriptions.create(options);

await assertSubscription(store, name, 0);
await store.subscriptions.delete(name);

options = {
includes: builder => builder.includeCounter("likes"),
Expand All @@ -54,10 +56,12 @@ describe("RavenDB_13478", function () {
name = await store.subscriptions.create(options);

await assertSubscription(store, name, 1);
await store.subscriptions.delete(name);

name = await store.subscriptions.create(Product);

await assertSubscription(store, name, 2);
await store.subscriptions.delete(name);
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/Ported/Server/LogsConfigurationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { disposeTestDocumentStore, RavenTestContext, testContext } from "../../Utils/TestUtil.js";
import { assertThat } from "../../Utils/AssertExtensions.js";

(RavenTestContext.is70Server ? describe.skip : describe)("LogsConfigurationTest", function () {
(RavenTestContext.isRavenDbServerVersion("7.0") ? describe.skip : describe)("LogsConfigurationTest", function () {

let store: IDocumentStore;

Expand Down
4 changes: 2 additions & 2 deletions test/Ported/UniqueValuesTest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from "node:assert"
import { testContext, disposeTestDocumentStore } from "../Utils/TestUtil.js";
import {testContext, disposeTestDocumentStore, RavenTestContext} from "../Utils/TestUtil.js";

import {
IDocumentStore,
Expand Down Expand Up @@ -167,7 +167,7 @@ describe("UniqueValuesTest", function () {
new DeleteCompareExchangeValueOperation<string>("key/2", 0));
assert.fail("should have thrown");
} catch (e) {
assert.strictEqual(e.name, "RavenException")
assert.strictEqual(e.name, RavenTestContext.isRavenDbServerVersion("6.2") ? "RavenException" : "AssertionError")
}
});

Expand Down
4 changes: 3 additions & 1 deletion test/Utils/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ class TestSecuredServiceLocator extends RavenServerLocator {

export class RavenTestContext extends RavenTestDriver implements IDisposable {

public static is70Server = process.env["RAVENDB_SERVER_VERSION"] >= "7.0";
public static isRavenDbServerVersion(version: string): boolean {
return process.env["RAVENDB_SERVER_VERSION"] >= version;
}

public static isPullRequest = !process.env["RAVEN_License"];

Expand Down
Loading