feat: tests

This commit is contained in:
2023-04-21 12:08:35 +02:00
parent 8cb9285462
commit d8c79256c9
140 changed files with 2100 additions and 2693 deletions

View File

@@ -6,20 +6,20 @@
"main": "lib/index.js",
"scripts": {
"build": "tsup --dts",
"format": "prettier .",
"format:fix": "prettier --write .",
"format": "prettier . --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
"test": "nyc mocha 'test/**/*.spec.ts'"
"test": "c8 mocha"
},
"devDependencies": {
"@openstapps/eslint-config": "workspace:*",
"@openstapps/nyc-config": "workspace:*",
"@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*",
"@types/node": "18.15.3",
"@types/chai": "4.3.4",
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"c8": "7.13.0",
"chai": "4.3.7",
"mocha": "10.2.0",
"ts-node": "10.9.1",
@@ -41,8 +41,5 @@
"@openstapps"
]
},
"nyc": {
"extends": "@openstapps/nyc-config"
},
"exports": "./lib/index.js"
}

View File

@@ -12,8 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {chunk} from '../src/chunk.js';
import {chunk} from '../src/index.js';
import {expect} from 'chai';
describe('chunk', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {differenceBy} from '../src/difference.js';
import {differenceBy} from '../src/index.js';
import {expect} from 'chai';
describe('differenceBy', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {get} from '../src/get.js';
import {get} from '../src/index.js';
import {expect} from 'chai';
describe('get', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {groupBy, groupByStable, groupByProperty} from '../src/group-by.js';
import {groupBy, groupByStable, groupByProperty} from '../src/index.js';
import {expect} from 'chai';
describe('groupBy', () => {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {keyBy} from '../src/key-by.js';
import {keyBy} from '../src/index.js';
import {expect} from 'chai';
describe('keyBy', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {mapValues} from '../src/map-values.js';
import {mapValues} from '../src/index.js';
import {expect} from 'chai';
describe('map-values', () => {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {minBy} from '../src/min.js';
import {minBy} from '../src/index.js';
import {expect} from 'chai';
describe('minBy', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {omit} from '../src/omit.js';
import {omit} from '../src/index.js';
import {expect} from 'chai';
describe('omit', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {partition} from '../src/partition.js';
import {partition} from '../src/index.js';
import {expect} from 'chai';
describe('partition', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {pick} from '../src/pick.js';
import {pick} from '../src/index.js';
import {expect} from 'chai';
describe('pick', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {shuffle} from '../src/shuffle.js';
import {shuffle} from '../src/index.js';
import {expect} from 'chai';
describe('shuffle', function () {

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {stringSort, stringSortBy} from '../src/string-sort.js';
import {stringSort, stringSortBy} from '../src/index.js';
import {expect} from 'chai';
describe('stringSort', () => {

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {expect} from 'chai';
import {sum, sumBy} from '../src/sum.js';
import {sum, sumBy} from '../src/index.js';
describe('sum', () => {
it('should return the sum of all elements in the collection', () => {

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {expect} from 'chai';
import {Tree, treeGroupBy} from '../src/tree-group.js';
import {Tree, treeGroupBy} from '../src/index.js';
interface TestItem {
id: number;

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {expect} from 'chai';
import {uniqBy} from '../src/uniq.js';
import {uniqBy} from '../src/index.js';
describe('uniq', function () {
it('should return an array with unique values', function () {

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {expect} from 'chai';
import {zip} from '../src/zip.js';
import {zip} from '../src/index.js';
describe('zip', function () {
it('should zip arrays together', function () {