-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(main) add top-level import test (#298)
* chore(main) add top-level import test * fix(tests) disable node tests
- Loading branch information
1 parent
19e4303
commit d591170
Showing
4 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// hubble.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
|
||
import test from 'tape-promise/tape'; | ||
|
||
import * as hubble from 'hubble.gl'; | ||
import * as core from '@hubble.gl/core'; | ||
import * as react from '@hubble.gl/react'; | ||
|
||
test('Top-level imports', t0 => { | ||
const hasEmptyExports = obj => { | ||
for (const key in obj) { | ||
if (obj[key] === undefined) { | ||
return key; | ||
} | ||
} | ||
return false; | ||
}; | ||
|
||
t0.test('import "hubble.gl"', t => { | ||
t.notOk(hasEmptyExports(hubble), 'No empty top-level export in hubble.gl'); | ||
t.notOk(hasEmptyExports(core), 'No empty top-level export in @hubble.gl/core'); | ||
t.notOk(hasEmptyExports(react), 'No empty top-level export in @hubble.gl/react'); | ||
t.end(); | ||
}); | ||
|
||
t0.end(); | ||
}); | ||
|
||
test('hubble.gl re-exports', t => { | ||
const findMissingExports = (source, target) => { | ||
const missingExports = []; | ||
for (const key in source) { | ||
// Exclude experimental exports | ||
if (key[0] !== '_' && key !== 'experimental' && target[key] !== source[key]) { | ||
missingExports.push(key); | ||
} | ||
} | ||
return missingExports.length ? missingExports : null; | ||
}; | ||
|
||
t.notOk(findMissingExports(core, hubble), 'hubble.gl re-exports everything from @hubble.gl/core'); | ||
t.notOk( | ||
findMissingExports(react, hubble), | ||
'hubble.gl re-exports everything from @hubble.gl/react' | ||
); | ||
|
||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// hubble.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
import './imports-spec'; | ||
import '../modules/core/test/index'; | ||
import '../modules/main/test/index'; | ||
import '../modules/react/test/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters