aboutsummaryrefslogtreecommitdiffstats
path: root/test/node_smoke_tests/dual/factory/import-and-require-factory.js
blob: c94ae374e79311ac00e2105327778896da1533bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import assert from "node:assert/strict";
import { JSDOM } from "jsdom";

const { window } = new JSDOM( "" );

const { jQueryFactory: factoryImported } = await import( process.argv[ 2 ] );
const { jQueryFactory: factoryRequired } = await import( "../lib/jquery-require-factory.cjs" );

assert( factoryImported === factoryRequired,
	"More than one copy of jQueryFactory exists" );

assert( !( "expando" in factoryImported ),
	"jQuery.expando should not be attached to the factory" );

const $ = factoryImported( window );

assert( /^jQuery/.test( $.expando ), "jQuery.expando should be detected" );