Skip to content

Commit

Permalink
Merge pull request #428 from swrlab/dev/v1.0.0
Browse files Browse the repository at this point in the history
Release v1.0.0
  • Loading branch information
rafaelmaeuer authored Jul 27, 2022
2 parents 1405f37 + e9f9d99 commit 15e37b9
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
- feature/*

env:
NODE_VERSION: 16.15
NODE_VERSION: 18

jobs:
build:
name: Lint Code Base
name: Test Code Base
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ by [**SWR Audio Lab**](https://lab.swr.de/)

## Changelog

- 2022-07-27 - v1.0.0
- chore: move node-crc to swrlab account
- feat: add mocha tests for strings utils

- 2022-07-26 - v1.0.10-beta
- chore: merge `frytg/undici-wrapper` into this package

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

This repository contains several frequently used packages and scripts for easier access and maintenance.

*Please note: This project is still under development!*

- [SWR Audio Lab / Node.js Utils](#swr-audio-lab--nodejs-utils)
- [Install](#install)
- [Packages](#packages)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swrlab/utils",
"version": "1.0.10-beta",
"version": "1.0.0",
"description": "Wrapping common SWR Audio Lab utils",
"main": "./src/index.js",
"engines": {
Expand All @@ -24,9 +24,9 @@
"dependencies": {
"@google-cloud/storage": "^6.2.3",
"abort-controller": "^3.0.0",
"aws-sdk": "^2.1181.0",
"aws-sdk": "^2.1182.0",
"chai": "^4.3.6",
"node-crc": "rafaelmaeuer/node-crc#v2.0.15",
"node-crc": "swrlab/node-crc#v2.0.15",
"undici": "^5.8.0",
"uuid": "8.3.2"
},
Expand Down
146 changes: 144 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable sonarjs/no-duplicate-string */
/*
by SWR audio lab
Expand All @@ -11,9 +12,150 @@

const { expect } = require('chai')
const createHashedId = require('../utils/ard/createHashedId')
const strings = require('../packages/strings')

describe('Test ARD-CoreID', () => {
it('createHashedId test', () => {
describe('Test ARD-CoreID Hash', () => {
it('createHashedId("test") = 0c171b2e54a30c11', () => {
expect(createHashedId('test')).to.equal('0c171b2e54a30c11')
})
})

describe('Test getObjectLength', () => {
it('getObjectLength({ hello: "world" }) = 1', () => {
expect(strings.getObjectLength({ hello: 'world' })).to.equal(1)
})

it('getObjectLength({ hello: "world", foo: "bar" }) = 2', () => {
expect(strings.getObjectLength({ hello: 'world', foo: 'bar' })).to.equal(2)
})
})

describe('Test isArray', () => {
it('isArray(["hello world"]) = true', () => {
expect(strings.isArray(['hello world'])).to.equal(true)
})

it('isArray({ hello: "world" }) = false', () => {
expect(strings.isArray({ hello: 'world' })).to.equal(false)
})
})

describe('Test isEmptyArray', () => {
it('isEmptyArray([]) = true', () => {
expect(strings.isEmptyArray([])).to.equal(true)
})

it('isEmptyArray(["hello world"]) = false', () => {
expect(strings.isEmptyArray(['hello world'])).to.equal(false)
})
})

describe('Test isEmptyObject', () => {
it('isEmptyObject({}) = true', () => {
expect(strings.isEmptyObject({})).to.equal(true)
})

it('isEmptyObject({ hello: "world" }) = false', () => {
expect(strings.isEmptyObject({ hello: 'world' })).to.equal(false)
})
})

describe('Test isEven', () => {
it('isEven(2) = true', () => {
expect(strings.isEven(2)).to.equal(true)
})

it('isEven(1) = false', () => {
expect(strings.isEven(1)).to.equal(false)
})
})

describe('Test isIncluded', () => {
it('isIncluded("hello world", "hello") = true', () => {
expect(strings.isIncluded('hello world', 'hello')).to.equal(true)
})

it('isIncluded("hello world", "earth") = false', () => {
expect(strings.isIncluded('hello world', 'earth')).to.equal(false)
})
})

describe('Test isNull', () => {
it('isNull(null) = true', () => {
expect(strings.isNull(null)).to.equal(true)
})

it('isNull(undefined) = false', () => {
expect(strings.isNull(undefined)).to.equal(false)
})
})

describe('Test isObject', () => {
it('isObject({ hello: "world" }) = true', () => {
expect(strings.isObject({ hello: 'world' })).to.equal(true)
})

it('isObject("hello world") = false', () => {
expect(strings.isObject('hello world')).to.equal(false)
})
})

describe('Test isUndefined', () => {
it('isUndefined(undefined) = true', () => {
expect(strings.isUndefined(undefined)).to.equal(true)
})

it('isUndefined(null) = false', () => {
expect(strings.isUndefined(null)).to.equal(false)
})
})

describe('Test notEmptyArray', () => {
it('notEmptyArray(["hello world"]) = true', () => {
expect(strings.notEmptyArray(['hello world'])).to.equal(true)
})

it('notEmptyArray([]) = false', () => {
expect(strings.notEmptyArray([])).to.equal(false)
})
})

describe('Test notEmptyObject', () => {
it('notEmptyObject({ hello: "world" }) = true', () => {
expect(strings.notEmptyObject({ hello: 'world' })).to.equal(true)
})

it('notEmptyObject({}) = false', () => {
expect(strings.notEmptyObject({})).to.equal(false)
})
})

describe('Test notNullOrUndefined', () => {
it('notNullOrUndefined("hello world") = true', () => {
expect(strings.notNullOrUndefined('hello world')).to.equal(true)
})

it('notNullOrUndefined(null) = false', () => {
expect(strings.notNullOrUndefined(null)).to.equal(false)
})

it('notNullOrUndefined(undefined) = false', () => {
expect(strings.notNullOrUndefined(undefined)).to.equal(false)
})
})

describe('Test removeDoubleSpaces', () => {
it('removeDoubleSpaces("hello world")) = hello world', () => {
expect(strings.removeDoubleSpaces('hello world')).to.equal('hello world')
})

it('removeDoubleSpaces("hello world once again")) = hello world once again', () => {
expect(strings.removeDoubleSpaces('hello world once again')).to.equal('hello world once again')
})
})

describe('Test toHex', () => {
it('toHex("hello world")) = 68656c6c6f20776f726c64', () => {
expect(strings.toHex('hello world')).to.equal('68656c6c6f20776f726c64')
})
})
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ available-typed-arrays@^1.0.5:
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==

aws-sdk@^2.1181.0:
version "2.1181.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1181.0.tgz#6ec2997881ae3df76e56d7150fc2992f12ce43dc"
integrity sha512-AAHSknRFAIjXBA/XNAL7gS79agr1LbS0oGimOJqJauGSJfWNaOpDc7z6OLNUQqGa5Joc3maD5QJcSKp1Pm/deQ==
aws-sdk@^2.1182.0:
version "2.1182.0"
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1182.0.tgz#7364e3e104f62b61018a00f19f2ffc989b1780ed"
integrity sha512-iemVvLTc2iy0rz3xTp8zc/kD27gIfDF/mk6bxY8/35xMulKCVANWUkAH8jWRKReHh5F/gX4bp33dnfG63ny1Ww==
dependencies:
buffer "4.9.2"
events "1.1.1"
Expand Down Expand Up @@ -1965,9 +1965,9 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=

node-crc@rafaelmaeuer/node-crc#v2.0.15:
node-crc@swrlab/node-crc#v2.0.15:
version "2.0.15"
resolved "https://codeload.github.com/rafaelmaeuer/node-crc/tar.gz/9d0d20f171efb60265bbc91246a2497856f5fd89"
resolved "https://codeload.github.com/swrlab/node-crc/tar.gz/9d0d20f171efb60265bbc91246a2497856f5fd89"
dependencies:
"@types/node" "^18.0.0"
detect-libc "^2.0.1"
Expand Down

0 comments on commit 15e37b9

Please sign in to comment.