[gjs/esm/dynamic-imports: 6/7] Add dynamic import tests.
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/esm/dynamic-imports: 6/7] Add dynamic import tests.
- Date: Tue, 9 Feb 2021 03:14:43 +0000 (UTC)
commit 336a1b2e107503d9cc5253f36270f48bc7d0b347
Author: Evan Welsh <contact evanwelsh com>
Date: Mon Feb 8 19:06:25 2021 -0800
Add dynamic import tests.
installed-tests/js/testESModules.js | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/installed-tests/js/testESModules.js b/installed-tests/js/testESModules.js
index a36cccc5..5b0cab6a 100644
--- a/installed-tests/js/testESModules.js
+++ b/installed-tests/js/testESModules.js
@@ -68,6 +68,16 @@ describe('Builtin ES modules', function () {
expect(typeof N_).toBe('function');
});
+ it('gettext named dynamic import', async function () {
+ const localGettext = await import('gettext');
+ expect(typeof localGettext.ngettext).toEqual('function');
+ });
+
+ it('gettext dynamic import matches static import', async function () {
+ const localGettext = await import('gettext');
+ expect(localGettext.default).toEqual(gettext);
+ });
+
it('system default import', function () {
expect(typeof system.exit).toBe('function');
});
@@ -76,6 +86,16 @@ describe('Builtin ES modules', function () {
expect(typeof exit).toBe('function');
expect(exit).toBe(system.exit);
});
+
+ it('system dynamic import matches static import', async function () {
+ const localSystem = await import('system');
+ expect(localSystem.default).toEqual(system);
+ });
+
+ it('system named dynamic import', async function () {
+ const localSystem = await import('system');
+ expect(typeof localSystem.exit).toBe('function');
+ });
});
describe('Dynamic imports', function () {
@@ -96,4 +116,8 @@ describe('Dynamic imports', function () {
it('named import', function () {
expect(module.say('hi')).toEqual('<( hi )');
});
+
+ it('dynamic gi import matches static', async function () {
+ expect((await import('gi://Gio')).default).toEqual(Gio);
+ });
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]