-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(folder): improve folder structure management
- Loading branch information
1 parent
0a61e9e
commit ba33946
Showing
43 changed files
with
214 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,7 @@ | |
"compilerOptions": { | ||
"sourceMap": false | ||
}, | ||
"exclude": ["tests"] | ||
"exclude": [ | ||
"__tests__" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/domain/__tests__/services/folders/dtos/update-folder-dto.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Folder } from '@sharingan/database'; | ||
|
||
import { UpdateFolderDto } from '../../../../index'; | ||
import { createTestFolderDto, generateTestId } from '../../../setup/test-utils'; | ||
|
||
describe('Test Update Folder DTO', () => { | ||
it('should return the folder to update', () => { | ||
const parentId = generateTestId(); | ||
const userId = generateTestId(); | ||
|
||
const dto = new UpdateFolderDto({ | ||
creatorId: userId, | ||
folderId: parentId, | ||
name: 'folder updated', | ||
}); | ||
|
||
const currentFolder = createTestFolderDto({ parentId, userId }).toFolder(); | ||
|
||
const folderToUpdate = dto.toFolder(currentFolder); | ||
|
||
const expectedFolder: Folder = { | ||
createdAt: currentFolder.createdAt, | ||
id: currentFolder.id, | ||
isFavorite: currentFolder.isFavorite, | ||
name: 'folder updated', | ||
parentId: currentFolder.parentId, | ||
path: currentFolder.path, | ||
updatedAt: currentFolder.updatedAt, | ||
userId: currentFolder.userId, | ||
}; | ||
|
||
expect(folderToUpdate).toMatchObject(expectedFolder); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
packages/domain/__tests__/services/snippets/dtos/delete-snippet-dto.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import DeleteSnippetDto from '../../../../src/snippets/dtos/delete-snippet-dto'; | ||
import { generateTestId } from '../../../setup/test-utils'; | ||
|
||
describe('Test Delete Snippet DTO', () => { | ||
it('should have the right property defined', () => { | ||
const snippetId = generateTestId(); | ||
const userId = generateTestId(); | ||
|
||
// GIVEN | ||
const dto = new DeleteSnippetDto({ | ||
creatorId: userId, | ||
snippetId, | ||
}); | ||
|
||
// WHEN | ||
// THEN | ||
expect(dto.snippetId).toEqual(snippetId); | ||
expect(dto.creatorId).toEqual(userId); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
packages/domain/__tests__/services/snippets/dtos/update-snippet-dto.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Snippet } from '@sharingan/database'; | ||
|
||
import { UpdateSnippetDto } from '../../../../index'; | ||
import { createTestSnippetDto, generateTestId } from '../../../setup/test-utils'; | ||
|
||
describe('Test Update Snippet DTO', () => { | ||
it('should have the right property defined to update the snippet', () => { | ||
const snippetId = generateTestId(); | ||
const userId = generateTestId(); | ||
|
||
const dto = new UpdateSnippetDto({ | ||
content: | ||
'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t<div>Hello Updated</div>\n\t);\n};', | ||
creatorId: userId, | ||
description: 'Basic react component updated', | ||
language: 'tsx', | ||
lineHighlight: '[[1, "diff-add"]]', | ||
name: 'app-updated.tsx', | ||
snippetId, | ||
theme: 'one-dark-pro', | ||
visibility: 'private', | ||
}); | ||
|
||
const folderId = generateTestId(); | ||
const currentSnippet = createTestSnippetDto({ | ||
folderId, | ||
name: 'app.tsx', | ||
userId, | ||
visibility: 'public', | ||
}).toSnippet(); | ||
|
||
const snippetToUpdate = dto.toSnippet(currentSnippet); | ||
|
||
const expectedSnippet: Snippet = { | ||
content: | ||
'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t<div>Hello Updated</div>\n\t);\n};', | ||
createdAt: currentSnippet.createdAt, | ||
description: 'Basic react component updated', | ||
folderId: snippetToUpdate.folderId, | ||
id: currentSnippet.id, | ||
language: 'tsx', | ||
lineHighlight: '[[1, "diff-add"]]', | ||
name: 'app-updated.tsx', | ||
size: expect.any(Number), | ||
theme: 'one-dark-pro', | ||
updatedAt: currentSnippet.updatedAt, | ||
userId, | ||
visibility: 'private', | ||
}; | ||
|
||
expect(snippetToUpdate).toMatchObject(expectedSnippet); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,7 @@ | |
"compilerOptions": { | ||
"sourceMap": false | ||
}, | ||
"exclude": ["tests"] | ||
"exclude": [ | ||
"__tests__" | ||
] | ||
} |
2 changes: 1 addition & 1 deletion
2
...rc/oembed/tests/generate-metadata.test.ts → ..._tests__/oembed/generate-metadata.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...erer/content/tests/html-generator.test.ts → ..._/renderer/content/html-generator.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...er/content/tests/preview-template.test.ts → ...renderer/content/preview-template.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
.../src/renderer/content/tests/utils.test.ts → .../__tests__/renderer/content/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.