Fix compile errors
This commit is contained in:
parent
1bd19286fa
commit
cef39b2edd
@ -134,7 +134,8 @@ export class AddUser extends React.PureComponent<AddUserProps, AddUserState> {
|
||||
export class TeamUserList extends React.PureComponent<TeamUsersProps> {
|
||||
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)
|
||||
|
||||
@ -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<typeof fs.writeFileSync>
|
||||
const cpMock = cp.execFileSync as unknown as jest.Mock<typeof cp.execFileSync>
|
||||
|
||||
let outdated: Record<string, Outdated> = {}
|
||||
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)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@ -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<string, string>
|
||||
devDependencies?: Record<string, string>
|
||||
|
||||
5
packages/server/@types/express.d.ts
vendored
5
packages/server/@types/express.d.ts
vendored
@ -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<void>
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,9 +14,6 @@
|
||||
{
|
||||
"path": "../common"
|
||||
},
|
||||
{
|
||||
"path": "../common"
|
||||
},
|
||||
{
|
||||
"path": "../config"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user