Skip to content

Commit

Permalink
style: fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Oct 19, 2023
1 parent ba84479 commit 8733267
Show file tree
Hide file tree
Showing 7 changed files with 9,695 additions and 13,812 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/NordicPlayground/thingy-rocks-cloud-aws-js)](https://mergify.io)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![@commitlint/config-conventional](https://img.shields.io/badge/%40commitlint-config--conventional-brightgreen)](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier/)
[![ESLint: TypeScript](https://img.shields.io/badge/ESLint-TypeScript-blue.svg)](https://github.com/typescript-eslint/typescript-eslint)

Expand Down
26 changes: 15 additions & 11 deletions cdk/commonParent.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { commonParent } from './commonParent'

describe('commonParent()', () => {
it('should return the common parent directory', () =>
expect(
import { commonParent } from './commonParent.js'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
void describe('commonParent()', () => {
void it('should return the common parent directory', () =>
assert.equal(
commonParent([
'/some/dir/lambda/onMessage.ts',
'/some/dir/lambda/notifyClients.ts',
'/some/dir/lambda/wirepasPublish.ts',
'/some/dir/wirepas-5g-mesh-gateway/protobuf/ts/data_message.ts',
]),
).toEqual('/some/dir/'))
it('should return the entire parent tree for a single file', () =>
expect(commonParent(['/some/dir/lambda/onMessage.ts'])).toEqual(
'/some/dir/',
))
void it('should return the entire parent tree for a single file', () =>
assert.equal(
commonParent(['/some/dir/lambda/onMessage.ts']),
'/some/dir/lambda/',
))
it('should return "/" if files have no common directory', () =>
expect(
void it('should return "/" if files have no common directory', () =>
assert.equal(
commonParent([
'/some/dir/lambda/onMessage.ts',
'/other/dir/lambda/onMessage.ts',
]),
).toEqual('/'))
'/',
))
})
4 changes: 2 additions & 2 deletions cdk/packLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import swc from '@swc/core'
import { createWriteStream } from 'node:fs'
import { parse } from 'path'
import * as yazl from 'yazl'
import { commonParent } from './commonParent'
import { findDependencies } from './findDependencies'
import { commonParent } from './commonParent.js'
import { findDependencies } from './findDependencies.js'

/**
* In the bundle we only include code that's not in the layer.
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { extends: ["@commitlint/config-angular"] };
module.exports = { extends: ["@commitlint/config-conventional"] };
26 changes: 12 additions & 14 deletions lambda/validateWithTypeBox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { Type } from '@sinclair/typebox'
import { validateWithTypeBox } from './validateWithTypeBox'
import { validateWithTypeBox } from './validateWithTypeBox.js'
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'

describe('validateWithTypeBox', () => {
it('Should check input is valid', async () => {
void describe('validateWithTypeBox', () => {
void it('Should check input is valid', async () => {
const maybeValid = validateWithTypeBox(Type.Number())(42)
if ('value' in maybeValid) {
expect(maybeValid.value).toEqual(42)
} else {
throw new Error(`It should be valid!`)
}
assert.equal(
'value' in maybeValid && maybeValid.value,
42,
`It should be valid!`,
)
})
it("Should check as 'invalid' values less than 0", (done) => {
void it("Should check as 'invalid' values less than 0", () => {
const maybeValid = validateWithTypeBox(Type.Number({ minimum: 0 }))(-42)
if ('errors' in maybeValid) {
done()
} else {
throw new Error(`It should not be valid!`)
}
assert.equal('errors' in maybeValid, true, `It should not be valid!`)
})
})
Loading

0 comments on commit 8733267

Please sign in to comment.