mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
lint
This commit is contained in:
parent
8445c0bec2
commit
23843bdd14
@ -6,7 +6,7 @@ module.exports = {
|
||||
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**', '!src/seeds/**', '!build/**'],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
lines: 71,
|
||||
lines: 75,
|
||||
},
|
||||
},
|
||||
setupFiles: ['<rootDir>/test/testSetup.ts'],
|
||||
|
||||
@ -39,7 +39,8 @@
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sodium-native": "^4.0.4",
|
||||
"tsconfig-paths": "^4.1.2",
|
||||
"type-graphql": "^2.0.0-beta.2"
|
||||
"type-graphql": "^2.0.0-beta.2",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
|
||||
|
||||
@ -6,12 +6,12 @@ import { logger } from '@/logging/logger'
|
||||
|
||||
import { CommunityRoot } from './proto/3_3/CommunityRoot'
|
||||
import { CrossGroupType } from './proto/3_3/enum/CrossGroupType'
|
||||
import { GradidoCreation } from './proto/3_3/GradidoCreation'
|
||||
import { GradidoDeferredTransfer } from './proto/3_3/GradidoDeferredTransfer'
|
||||
import { GradidoTransfer } from './proto/3_3/GradidoTransfer'
|
||||
import { RegisterAddress } from './proto/3_3/RegisterAddress'
|
||||
import { TransactionBody } from './proto/3_3/TransactionBody'
|
||||
import { TransactionLogic } from './Transaction.logic'
|
||||
import { GradidoCreation } from './proto/3_3/GradidoCreation'
|
||||
import { GradidoDeferredTransfer } from './proto/3_3/GradidoDeferredTransfer'
|
||||
|
||||
let a: Transaction
|
||||
let b: Transaction
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
// https://www.npmjs.com/package/@apollo/protobufjs
|
||||
|
||||
import { isValidDateString } from '@validator/DateString'
|
||||
import { IsBoolean, IsUUID } from 'class-validator'
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
import { isValidDateString } from '@validator/DateString'
|
||||
|
||||
@InputType()
|
||||
export class CommunityDraft {
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'reflect-metadata'
|
||||
import { Community } from '@entity/Community'
|
||||
|
||||
import { TestDB } from '@test/TestDB'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import 'reflect-metadata'
|
||||
import { Account } from '@entity/Account'
|
||||
import { TestDB } from '@test/TestDB'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { v4 } from 'uuid'
|
||||
|
||||
import { TestDB } from '@test/TestDB'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
import { KeyPair } from '@/data/KeyPair'
|
||||
import { Mnemonic } from '@/data/Mnemonic'
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import 'reflect-metadata'
|
||||
import { Account } from '@entity/Account'
|
||||
import { TestDB } from '@test/TestDB'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { v4 } from 'uuid'
|
||||
|
||||
import { TestDB } from '@test/TestDB'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
import { KeyPair } from '@/data/KeyPair'
|
||||
import { Mnemonic } from '@/data/Mnemonic'
|
||||
|
||||
@ -1,13 +1,45 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { Timestamp } from '@/data/proto/3_3/Timestamp'
|
||||
|
||||
import { timestampToDate } from './typeConverter'
|
||||
import {
|
||||
base64ToBuffer,
|
||||
iotaTopicFromCommunityUUID,
|
||||
timestampSecondsToDate,
|
||||
timestampToDate,
|
||||
uuid4ToBuffer,
|
||||
} from './typeConverter'
|
||||
|
||||
describe('utils/typeConverter', () => {
|
||||
it('uuid4ToBuffer', () => {
|
||||
expect(uuid4ToBuffer('4f28e081-5c39-4dde-b6a4-3bde71de8d65')).toStrictEqual(
|
||||
Buffer.from('4f28e0815c394ddeb6a43bde71de8d65', 'hex'),
|
||||
)
|
||||
})
|
||||
|
||||
it('iotaTopicFromCommunityUUID', () => {
|
||||
expect(iotaTopicFromCommunityUUID('4f28e081-5c39-4dde-b6a4-3bde71de8d65')).toBe(
|
||||
'3138b3590311fdf0a823e173caa9487b7d275c23fab07106b4b1364cb038affd',
|
||||
)
|
||||
})
|
||||
|
||||
it('timestampToDate', () => {
|
||||
const now = new Date('Thu, 05 Oct 2023 11:55:18 +0000')
|
||||
const now = new Date('Thu, 05 Oct 2023 11:55:18.102 +0000')
|
||||
const timestamp = new Timestamp(now)
|
||||
expect(timestamp.seconds).toBe(Math.round(now.getTime() / 1000))
|
||||
expect(timestampToDate(timestamp)).toEqual(now)
|
||||
})
|
||||
|
||||
it('timestampSecondsToDate', () => {
|
||||
const now = new Date('Thu, 05 Oct 2023 11:55:18.102 +0000')
|
||||
const timestamp = new Timestamp(now)
|
||||
expect(timestamp.seconds).toBe(Math.round(now.getTime() / 1000))
|
||||
expect(timestampSecondsToDate(timestamp)).toEqual(new Date('Thu, 05 Oct 2023 11:55:18 +0000'))
|
||||
})
|
||||
|
||||
it('base64ToBuffer', () => {
|
||||
expect(base64ToBuffer('MTizWQMR/fCoI+FzyqlIe30nXCP6sHEGtLE2TLA4r/0=')).toStrictEqual(
|
||||
Buffer.from('3138b3590311fdf0a823e173caa9487b7d275c23fab07106b4b1364cb038affd', 'hex'),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@ -6388,7 +6388,7 @@ uuid@^8.3.2:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
uuid@^9.0.0:
|
||||
uuid@^9.0.0, uuid@^9.0.1:
|
||||
version "9.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
||||
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user