Skip to content

Commit af32751

Browse files
committed
test: fix instrument-bundler test
1 parent 295aff6 commit af32751

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/instrument-bundler/src/__tests__/repositories/interactive/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
22
import { createRoot } from '/runtime/v1/[email protected]/client';
33
import { z } from '/runtime/v1/[email protected]';
44

5+
const { sum } = await import('/runtime/v1/[email protected]');
6+
57
import './styles.css';
68
import '/runtime/v1/[email protected]/normalize.css';
79

@@ -18,7 +20,7 @@ export default defineInstrument({
1820
root.render(
1921
<div>
2022
<h1>Interactive Task</h1>
21-
<button onClick={() => done({})}>Done</button>
23+
<button onClick={() => done({ value: sum([1, 2, 3]) })}>Done</button>
2224
</div>
2325
);
2426
}

packages/instrument-bundler/src/__tests__/transform.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ import { transformImports } from '../transform.js';
44

55
describe('transformImports', () => {
66
it('should transform a default import', () => {
7-
expect(transformImports("import React from 'react';")).toBe("const { default: React } = await import('react');");
7+
expect(transformImports("import React from 'react';")).toBe("const { default: React } = await __import('react');");
88
});
99
it('should transform named imports', () => {
1010
expect(transformImports("import { useEffect, useState } from 'react';")).toBe(
11-
"const { useEffect, useState } = await import('react');"
11+
"const { useEffect, useState } = await __import('react');"
1212
);
1313
});
1414
it('should transform named and default imports from the same source', () => {
1515
expect(transformImports("import React, { useState } from 'react';")).toBe(
16-
"const { useState, default: React } = await import('react');"
16+
"const { useState, default: React } = await __import('react');"
1717
);
1818
});
1919
it('should transform a namespace import', () => {
20-
expect(transformImports("import * as React from 'react';")).toBe("const React = await import('react');");
20+
expect(transformImports("import * as React from 'react';")).toBe("const React = await __import('react');");
2121
});
2222
it('should transform named and default imports from the same source', () => {
2323
expect(transformImports("import _ from 'lodash'; import { useEffect, useState } from 'react';")).toBe(
24-
"const { default: _ } = await import('lodash'); const { useEffect, useState } = await import('react');"
24+
"const { default: _ } = await __import('lodash'); const { useEffect, useState } = await __import('react');"
2525
);
2626
});
2727
});

0 commit comments

Comments
 (0)