-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b30cef1
commit 3392c3f
Showing
8 changed files
with
283 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"id": "aaba6df4-cde1-3322-96cd-957fc76123e8", | ||
"nm": "List shared via URL", | ||
"ct": 45772460, | ||
"pr": 538, | ||
"prnt": null, | ||
"metadata": {}, | ||
"lm": 45772507 | ||
}, | ||
{ | ||
"id": "12f62eec-754c-b677-b683-7dd448dc49ac", | ||
"nm": "Normal list", | ||
"ct": 148, | ||
"pr": 200, | ||
"prnt": "aaba6df4-cde1-3322-96cd-957fc76123e8", | ||
"metadata": {}, | ||
"lm": 155459 | ||
}, | ||
{ | ||
"id": "68e27b97-4444-77c6-f6e8-22c1e94ab437", | ||
"nm": "", | ||
"ct": 150, | ||
"pr": 300, | ||
"prnt": "aaba6df4-cde1-3322-96cd-957fc76123e8", | ||
"metadata": {}, | ||
"lm": 157519, | ||
"as": "NnjJ.lybhWrZBRX" | ||
} | ||
], | ||
"shared_projects": { | ||
"aaba6df4-cde1-3322-96cd-957fc76123e8": { | ||
"share_id": "NnjJ.tUQQvYjgkX", | ||
"url_shared_info": { | ||
"write_permission": false, | ||
"permission_level": 1, | ||
"access_token": "plUzlWcMHcwbR3wZ" | ||
} | ||
} | ||
}, | ||
"most_recent_operation_transaction_id": "1160300075", | ||
"server_expanded_projects_list": [] | ||
} |
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,36 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"id": "de843e0e-2d25-a812-1415-6ed31ae618f4", | ||
"nm": "AAA", | ||
"ct": 146, | ||
"pr": 100, | ||
"prnt": null, | ||
"metadata": {}, | ||
"lm": 223 | ||
}, | ||
{ | ||
"id": "12f62eec-754c-b677-b683-7dd448dc49ac", | ||
"nm": "ZZZ", | ||
"ct": 148, | ||
"pr": 200, | ||
"prnt": null, | ||
"metadata": {}, | ||
"no": "Two Description", | ||
"lm": 155459 | ||
}, | ||
{ | ||
"id": "3e6b63c5-7e40-1e1e-9987-cd7af6e64893", | ||
"nm": "", | ||
"ct": 150, | ||
"pr": 150, | ||
"prnt": null, | ||
"metadata": {}, | ||
"lm": 157519, | ||
"as": "NnjJ.tUQQvYjgkX" | ||
} | ||
], | ||
"shared_projects": {}, | ||
"most_recent_operation_transaction_id": "1160300075", | ||
"server_expanded_projects_list": [] | ||
} |
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,39 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"id": "8960ce1b-e5b5-4aff-3303-50577f20e76b", | ||
"nm": "List shared via email", | ||
"ct": 45707709, | ||
"pr": 525, | ||
"prnt": null, | ||
"metadata": {}, | ||
"lm": 45708060 | ||
}, | ||
{ | ||
"id": "68e27b97-4444-77c6-f6e8-22c1e94ab431", | ||
"nm": "Normal second list", | ||
"ct": 158394, | ||
"pr": 400, | ||
"prnt": "8960ce1b-e5b5-4aff-3303-50577f20e76b", | ||
"metadata": {}, | ||
"lm": 158394 | ||
} | ||
], | ||
"shared_projects": { | ||
"8960ce1b-e5b5-4aff-3303-50577f20e76b": { | ||
"share_id": "NnjJ.lybhWrZBRX", | ||
"email_shared_info": { | ||
"emails": [ | ||
{ | ||
"email": "[email protected]", | ||
"access_token": "L2RdOGpOND", | ||
"write_permission": true, | ||
"permission_level": 3 | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"most_recent_operation_transaction_id": "1160300075", | ||
"server_expanded_projects_list": [] | ||
} |
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,60 @@ | ||
import mockInitializationData from "./mocks/get_initialization_data.json" with { | ||
type: "json", | ||
}; | ||
import mockTreeDataMain from "./mocks/get_tree_data_shared_main.json" with { | ||
type: "json", | ||
}; | ||
import mockTreeDataFirst from "./mocks/get_tree_data_shared_first.json" with { | ||
type: "json", | ||
}; | ||
import mockTreeDataSecond from "./mocks/get_tree_data_shared_second.json" with { | ||
type: "json", | ||
}; | ||
|
||
import { assertEquals } from "./test_deps.ts"; | ||
|
||
import { Document } from "../src/document.ts"; | ||
import type { Client } from "../src/client.ts"; | ||
import { InitializationDataSchema, TreeDataSchema } from "../src/schema.ts"; | ||
|
||
const mockClient = () => ({} as unknown as Client); | ||
const mockTree = () => TreeDataSchema.parse(mockTreeDataMain); | ||
const mockInitialization = () => | ||
InitializationDataSchema.parse(mockInitializationData); | ||
const mockSharedTrees = () => { | ||
const first = | ||
mockTreeDataFirst.shared_projects["aaba6df4-cde1-3322-96cd-957fc76123e8"] | ||
.share_id; | ||
const second = | ||
mockTreeDataSecond.shared_projects["8960ce1b-e5b5-4aff-3303-50577f20e76b"] | ||
.share_id; | ||
return { | ||
[first]: TreeDataSchema.parse(mockTreeDataFirst), | ||
[second]: TreeDataSchema.parse(mockTreeDataSecond), | ||
}; | ||
}; | ||
|
||
const mockDocument = () => | ||
new Document( | ||
mockClient(), | ||
mockTree(), | ||
mockInitialization(), | ||
mockSharedTrees(), | ||
); | ||
|
||
Deno.test("WorkFlowy Shared / X", () => { | ||
const document = mockDocument(); | ||
|
||
const firstShared = document.items[1]; | ||
|
||
assertEquals(firstShared.name, "List shared via URL"); | ||
|
||
assertEquals(firstShared.items.length, 2); | ||
assertEquals(firstShared.items[0].name, "Normal list"); | ||
|
||
const secondShared = firstShared.items[1]; | ||
|
||
assertEquals(secondShared.name, "List shared via email"); | ||
assertEquals(secondShared.items.length, 1); | ||
assertEquals(secondShared.items[0].name, "Normal second list"); | ||
}); |