fix: revert test case to use import syntax like other system tests

- Use ES6 import syntax instead of require for consistency
- Follow the same pattern as externals-system test case
- This should resolve the System is not defined error
This commit is contained in:
Deepak Prajapati 2025-10-06 20:08:25 +05:30
parent 20dc109ec2
commit 6644fe9a6e
2 changed files with 5 additions and 9 deletions

View File

@ -1,11 +1,10 @@
import React, { useEffect } from "react";
/* This test verifies that default imports work correctly with SystemJS externals
* when the external module doesn't have a default property (e.g., React)
*/
it("should correctly handle default import from SystemJS external", function() {
const React = require("react");
const { useEffect } = require("react");
// React should be the entire module object, not undefined
expect(React).toBeDefined();
expect(typeof React).toBe("object");

View File

@ -1,3 +1,6 @@
import React, { useEffect } from "react";
import ReactWithDefault, { useEffect as useEffectWithDefault } from "react-with-default";
/* This test verifies that default imports work correctly with SystemJS externals
* in both scenarios:
* 1. External module without default property (traditional SystemJS)
@ -5,9 +8,6 @@
*/
it("should correctly handle default import from SystemJS external without default property", function() {
const React = require("react");
const { useEffect } = require("react");
// React should be the entire module object, not undefined
expect(React).toBeDefined();
expect(typeof React).toBe("object");
@ -22,9 +22,6 @@ it("should correctly handle default import from SystemJS external without defaul
});
it("should correctly handle default import from SystemJS external with default property", function() {
const ReactWithDefault = require("react-with-default");
const { useEffect: useEffectWithDefault } = require("react-with-default");
// ReactWithDefault should be the default property value
expect(ReactWithDefault).toBeDefined();
expect(typeof ReactWithDefault).toBe("object");