• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-js / 7928337034

16 Feb 2024 09:06AM UTC coverage: 85.346%. Remained the same
7928337034

Pull #6360

github

web-flow
Update packages/realm-react/CHANGELOG.md

Co-authored-by: Andrew Meyer <andrew.meyer@mongodb.com>
Pull Request #6360: `@realm/react` key-path filtering on `useQuery` and `useObject`

942 of 1164 branches covered (80.93%)

Branch coverage included in aggregate %.

2372 of 2719 relevant lines covered (87.24%)

1015.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/realm/src/tests/utils.ts
1
////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2022 Realm Inc.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
//
17
////////////////////////////////////////////////////////////////////////////
18

19
import path from "node:path";
20
import fs from "node:fs";
21
import { fileURLToPath } from "node:url";
22

23
import type { Realm } from "../index";
24

25
export type RealmContext = Mocha.Context & { realm: Realm };
26

27
export function generateRandomInteger() {
28
  return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
×
29
}
30

31
export const REALMS_DIR = fileURLToPath(new URL("realms", import.meta.url));
×
32
export const REALMS_TEMP_DIR = path.resolve(REALMS_DIR, "temp");
×
33
if (!fs.existsSync(REALMS_TEMP_DIR)) {
×
34
  fs.mkdirSync(REALMS_TEMP_DIR, { recursive: true });
×
35
}
36

37
export function generateTempRealmPath() {
38
  return path.resolve(REALMS_TEMP_DIR, "random-" + generateRandomInteger() + ".realm");
×
39
}
40

41
export function closeRealm(this: Mocha.Context & Partial<RealmContext>) {
42
  if (this.realm && !this.realm.isClosed) {
×
43
    this.realm.close();
×
44
    delete this.realm;
×
45
  }
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc