-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
test: Add more sample data for testing Cache - and streamline its creation #2841
Conversation
…e format I may add json samples in future.
They are not all about frontmatter, and there will be overlapping concerns
Using template script mechanism
This shows that the order of the machine-generated may not be stable after running through 'yarn lint'.
Hi @ilandikov - the commit history is a mess on this, so I think I will probably squash it... But I am hoping that this will save you and Stanislav some time and ensure consistency - so it would really help if you could try out this new scripting mechanism on Tuesday and see if it works for you... |
I've fixed the formatting in the description. |
Just to be clear, you mean that we can reuse the new scripting mechanism to quickly create the files with test data from markdown files? Also, what is the role of broken links plugin? =) |
Yes exactly...
Some of the test files I added had accidentally-broken-links in them, and I wanted it to be visible so I could fix them. I'd added the plugin to the two documentation vaults previously, but never this one... |
Does the mechanism work for you? Can you try adding a new .md file and see the .ts file created? |
I thought of an improvement to the script. Currently it writes text out to the active note, which needs to be undone. I could instead use a Notice. |
Feedback:
|
What did you mean by that? It sounds serious |
Thank you for the feedback, it was really helpful. I've changed it so that:
I need to put this down, so will merge (well, squash) it. |
Just tried the latest version on my side - this is so much better =) Thanks! |
I've added a new yarn lint:test-data |
Nice! |
Description
New test data:
Tasks-Demo
vault, inTest Data/*.md
tests/Obsidian/__test_data__/*.ts
Streamlined creation and processing of this test data:
resources/sample_vaults/Tasks-Demo/_meta/templates/Test Data file.md
resources/sample_vaults/Tasks-Demo/_meta/templater_scripts/convert_test_data_markdown_to_js.js
resources/sample_vaults/Tasks-Demo/_meta/templates/convert_test_data_markdown_to_js.md
Note: sometimes editing the Markdown can change the order of the fields in the generated
.ts
file - e.g. see f40fe32. This is irritating but harmless.See the updated instructions in
Cache.test.ts
for how to use this new mechanism:Test creation sequence
root/Test Data/
) with the simplest contentto represent your test case. Choose a meaningful file name in snake case. See example in
Test Data/one_task.md
.resources/sample_vaults/Tasks-Demo/_meta/templates/Test Data file.md
Templater: Insert _meta/templates/convert_test_data_markdown_to_js.md
Ctrl + Cmd + Alt + T
/Ctrl + Ctrl + Alt + T
root/Test Data/*.md
to test functions intests/Obsidian/__test_data__/*.ts
yarn lint
to standardise the formatting in the generated TypeScript files.readTasksFromSimulatedFile()
, the argument is the constant youcreated in the previous step.
Motivation and Context
How has this been tested?
Screenshots (if appropriate)
Types of changes
Internal changes:
test
- additions and improvements to unit tests and the smoke tests)Checklist
yarn run lint
.Terms