Skip to content

Commit

Permalink
Update tests to download both .tgz and image pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Oct 25, 2023
1 parent ab170a6 commit 5981793
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tests/webR/webr-worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ beforeAll(async () => {
describe('Download and install binary webR packages', () => {
test('Install packages via evalR', async () => {
const warnSpy = jest.spyOn(console, 'warn').mockImplementation((...args) => {});

// Downloading and extracting a .tgz package
await webR.evalR(
'webr::install("cli", repos="https://repo.r-wasm.org/", mount = FALSE)'
);
const pkg = (await webR.evalR('"cli" %in% library(cli)')) as RLogical;
let pkg = (await webR.evalR('"cli" %in% library(cli)')) as RLogical;
expect(await pkg.toBoolean()).toEqual(true);

// Downloading and mounting an Emscripten FS image
await webR.evalR(
'webr::install("lattice", repos="https://repo.r-wasm.org/", mount = TRUE)'
);
pkg = (await webR.evalR('"lattice" %in% library(lattice)')) as RLogical;
expect(await pkg.toBoolean()).toEqual(true);

warnSpy.mockRestore();
});

Expand Down

0 comments on commit 5981793

Please sign in to comment.