Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions __tests__/files/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,6 @@ describe('Displayname attribute', () => {
})

describe('Sanity checks', () => {
test('Invalid id', () => {
expect(() => new File({
source: 'https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg',
mime: 'image/jpeg',
owner: 'emma',
id: '1234' as unknown as number,
})).toThrowError('Invalid id type of value')
})

test('Invalid source', () => {
expect(() => new File({} as unknown as NodeData)).toThrowError('Missing mandatory source')
expect(() => new Folder({
Expand Down
4 changes: 2 additions & 2 deletions lib/node/nodeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Attribute { [key: string]: any }

export interface NodeData {
/** Unique ID */
id?: number
id?: number|string

/**
* URL to the resource.
Expand Down Expand Up @@ -73,7 +73,7 @@ export const isDavResource = function(source: string, davService: RegExp): boole
* @param davService Pattern to check if source is DAV ressource
*/
export const validateData = (data: NodeData, davService: RegExp) => {
if (data.id && typeof data.id !== 'number') {
if (data.id && typeof data.id !== 'number' && typeof data.id !== 'string') {
throw new Error('Invalid id type of value')
}

Expand Down
Loading