diff --git a/packages/client/src/team/TeamUserList.tsx b/packages/client/src/team/TeamUserList.tsx index 0849c79..7fbde5f 100644 --- a/packages/client/src/team/TeamUserList.tsx +++ b/packages/client/src/team/TeamUserList.tsx @@ -134,7 +134,8 @@ export class AddUser extends React.PureComponent { export class TeamUserList extends React.PureComponent { async componentDidMount() { await this.fetchUsersInTeam(this.props.team.id) - } async componentWillReceiveProps(nextProps: TeamUsersProps) { + } + async componentWillReceiveProps(nextProps: TeamUsersProps) { const {team} = nextProps if (team.id !== this.props.team.id) { this.fetchUsersInTeam(team.id) diff --git a/packages/scripts/src/scripts/update.test.ts b/packages/scripts/src/scripts/update.test.ts index 0b900e2..2e11afe 100644 --- a/packages/scripts/src/scripts/update.test.ts +++ b/packages/scripts/src/scripts/update.test.ts @@ -4,7 +4,7 @@ jest.mock('../log') import cp from 'child_process' import * as fs from 'fs' -import {update, Outdated} from './update' +import {update} from './update' describe('update', () => { @@ -15,19 +15,12 @@ describe('update', () => { const writeMock = fs.writeFileSync as jest.Mock const cpMock = cp.execFileSync as unknown as jest.Mock - let outdated: Record = {} beforeEach(() => { - outdated = {} - cpMock.mockClear() readMock.mockClear() writeMock.mockClear() - cpMock.mockImplementation(() => { - const err = new Error('Exit code 1'); - (err as any).stdout = stringify(outdated) - throw err - }) + cpMock.mockImplementation(() => Buffer.from('7.8.9\n') as any) readMock.mockReturnValue(stringify({ name: 'test', dependencies: { @@ -39,43 +32,30 @@ describe('update', () => { }) as any) }) - it('does not change when no changes', async () => { - cpMock.mockReturnValue('{}' as any) - await update('update', '/my/dir') - expect(writeMock.mock.calls.length).toBe(0) - }) - - it('does not change when npm outdated output is empty', async () => { - cpMock.mockReturnValue('' as any) - await update('update', '/my/dir') - expect(writeMock.mock.calls.length).toBe(0) - }) - it('updates outdated dependencies in package.json', async () => { - outdated = { - a: { - wanted: '1.2.3', - latest: '1.4.0', - location: '', - }, - b: { - wanted: '3.4.6', - latest: '3.4.7', - location: '', - }, - } await update('update', '/my/dir') expect(writeMock.mock.calls).toEqual([[ '/my/dir/package.json', stringify({ name: 'test', dependencies: { - a: '^1.4.0', + a: '^7.8.9', }, devDependencies: { - b: '^3.4.7', + b: '^7.8.9', }, }), ]]) }) + it('does not fail when package has no deps', async () => { + readMock.mockReturnValue(stringify({}) as any) + await update('update', '/my/dir') + }) + + it('does not write when dryRun', async () => { + readMock.mockReturnValue(stringify({}) as any) + await update('update', '--dryRun', '/my/dir') + expect(writeMock.mock.calls.length).toBe(0) + }) + }) diff --git a/packages/scripts/src/scripts/update.ts b/packages/scripts/src/scripts/update.ts index ce54ff1..77802bf 100644 --- a/packages/scripts/src/scripts/update.ts +++ b/packages/scripts/src/scripts/update.ts @@ -4,12 +4,6 @@ import cp from 'child_process' import {argparse, arg} from '@rondo.dev/argparse' import {info} from '../log' -export interface Outdated { - wanted: string - latest: string - location: string -} - export interface Package { dependencies?: Record devDependencies?: Record diff --git a/packages/server/@types/express.d.ts b/packages/server/@types/express.d.ts index a91e2f3..fb65b0a 100644 --- a/packages/server/@types/express.d.ts +++ b/packages/server/@types/express.d.ts @@ -1,16 +1,13 @@ -declare namespace Application { +declare namespace Express { export interface User { id: number username: string firstName: string lastName: string } -} -declare namespace Express { export interface Request { correlationId: string - user?: Application.User logInPromise(user: any): Promise } } diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 1faec63..441dc53 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -14,9 +14,6 @@ { "path": "../common" }, - { - "path": "../common" - }, { "path": "../config" },