Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forked new build system #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@ data.json

# local developer scripts
deployLocally.js

# Intellij
*.iml
.idea

# npm
node_modules
package-lock.json

# build
main.js
*.js.map

# obsidian dev files
data.json

# macOS
.DS_Store

# local developer scripts
deployLocally.js

dist/
.hotreload
.env
.vscode
.in
.out
33 changes: 17 additions & 16 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"editor.formatOnSave": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
"editor.formatOnSave": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"git-blame.gitWebUrl": ""
}
File renamed without changes.
159 changes: 159 additions & 0 deletions archive/get-todos.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { expect, test } from "vitest";
import { getTodos } from "../src/get-todos";

test("single todo element should return itself", () => {
// GIVEN
const lines = ["- [ ] tada"];

// WHEN
const result = getTodos({ lines });

// THEN
const todos = ["- [ ] tada"];
expect(result).toStrictEqual(todos);
});

test("get todos with children", function () {
// GIVEN
const lines = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
"- this isn't copied",
];

// WHEN
const todos = getTodos({ lines: lines, withChildren: true });

// THEN
const result = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];
expect(todos).toStrictEqual(result);
});

test("get todos without children", () => {
// GIVEN
const lines = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
"- this isn't copied",
];

// WHEN
const todos = getTodos({ lines });

// THEN
const result = [
"- [ ] TODO",
" - [ ] Next",
"- [ ] Another one",
" - [ ] More children",
];
expect(todos).toStrictEqual(result);
});

test("get todos with children doesn't fail if child at end of list", () => {
// GIVEN
const lines = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];

// WHEN
const todos = getTodos({ lines, withChildren: true });

// THEN
const result = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];
expect(todos).toStrictEqual(result);
});

test("get todos with nested children also adds nested children", () => {
// GIVEN
const lines = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
" - some stuff",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];

// WHEN
const todos = getTodos({ lines, withChildren: true });

// THEN
const result = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
" - some stuff",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];
expect(todos).toStrictEqual(result);
});

test("get todos doesn't add intermediate other elements", () => {
// GIVEN
const lines = [
"# Some title",
"",
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"",
"## Some title",
"",
"Some text",
"...that continues here",
"",
"- Here is a bullet item",
"- Here is another bullet item",
"1. Here is a numbered list item",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];

// WHEN
const todos = getTodos({ lines, withChildren: true });

// THEN
const result = [
"- [ ] TODO",
" - [ ] Next",
" - some stuff",
"- [ ] Another one",
" - [ ] More children",
" - another child",
];
expect(todos).toStrictEqual(result);
});
Loading