All files / src index.ts

52.94% Statements 9/17
0% Branches 0/2
100% Functions 5/5
42.86% Lines 6/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 238x     8x 8x                         8x 8x     47x  
import { TonClient } from "@rsquad-test/core";
 
let library: typeof TonClient;
try {
  library = require("./tonclient.node");
} catch (error) {
  const fs = require("fs");
  const os = require("os");
  const path = require("path");
  let addonPath = path.resolve(__dirname, "tonclient.node");
  if (fs.existsSync(addonPath)) {
    throw error;
  }
  addonPath = path.resolve(os.homedir(), "tonclient.node");
  library = require(addonPath);
}
 
(async () => {
  TonClient.loadBinaryLibrary((): Promise<any> => new Promise((res) => res(library)));
})();
 
export { TonClient };