Skip to content

Commit

Permalink
Ensure that Realm enums are accessible (#5484)
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobOscarGunnarsson authored Feb 24, 2023
1 parent 046f43b commit f14917b
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration-tests/tests/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import "./tests/objects";
import "./tests/queries";
import "./tests/realm-constructor";
import "./tests/schema";
import "./tests/enums";
import "./tests/serialization";
import "./tests/set";
import "./tests/list";
Expand Down
87 changes: 87 additions & 0 deletions integration-tests/tests/src/tests/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import { expect } from "chai";
import {
ConnectionState,
NumericLogLevel,
OpenRealmBehaviorType,
OpenRealmTimeOutBehavior,
SessionStopPolicy,
} from "realm";

describe("Enums", function () {
describe("ConnectionState", function () {
it("is accessible", function () {
expect(ConnectionState).deep.equals({
Disconnected: "disconnected",
Connecting: "connecting",
Connected: "connected",
});
});
});
describe("SessionStopPolicy", function () {
it("is accessible", function () {
expect(SessionStopPolicy).deep.equals({
AfterUpload: "after-upload",
Immediately: "immediately",
Never: "never",
});
});
});
describe("OpenRealmBehaviorType", function () {
it("is accessible", function () {
expect(OpenRealmBehaviorType).deep.equals({
DownloadBeforeOpen: "downloadBeforeOpen",
OpenImmediately: "openImmediately",
});
});
});
describe("OpenRealmTimeOutBehavior", function () {
it("is accessible", function () {
expect(OpenRealmTimeOutBehavior).deep.equals({
OpenLocalRealm: "openLocalRealm",
ThrowException: "throwException",
});
});
});
describe("NumericLogLevel", function () {
it("is accessible", function () {
expect(NumericLogLevel).deep.equals({
"0": "All",
"1": "Trace",
"2": "Debug",
"3": "Detail",
"4": "Info",
"5": "Warn",
"6": "Error",
"7": "Fatal",
"8": "Off",
All: 0,
Trace: 1,
Debug: 2,
Detail: 3,
Info: 4,
Warn: 5,
Error: 6,
Fatal: 7,
Off: 8,
});
});
});
});

0 comments on commit f14917b

Please sign in to comment.