-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: load default config when creating a project #471
Conversation
creating project in mapeo manager
Working on this I found that I had an error on the default config that is on the project. So - despite being out of scope - I'll probably add a test for the default config... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/mapeo-manager.js
Outdated
// TODO: see how to expose warnings to frontend | ||
/* eslint-disable no-unused-vars */ | ||
const warnings = await project.importConfig({ | ||
configPath: path.resolve(DEFAULT_CONFIG_PATH), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should this resolve relative to __dirname
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right. But we can't use __dirname with ES modules, so I think need to
new URL(configPath, import.meta.url).pathname
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, that's better. I'd love that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming CI passes.
Yeah, I see that E2E tests are failing on project-crud.js. Gotta see whats that all about but its hard to pinpoint since the output is kinda huge - and at a first glance it doesn't seem to be related to this??? - ... |
So, tests are failing on st.alike(project, {name: 'project1', defaultPresets: undefined}) which fails because st.is(project.name, 'project1') Another option would not to run |
I think this test is the best place to check that the config has been imported when a project is created. I suggest:
|
the config is already read when doing |
As far as I can see, we don't yet have any tests for
Should probably also check icons are correctly there in both scenarios too. A test helper function to get |
1. check default config against the project config 2. check custom config agains explicitly loaded custom config
test-e2e/manager-basic.js
Outdated
'the default presets loaded is equal to the number of presets in the default config' | ||
) | ||
|
||
st.alike( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this asssertion - and the following in this group - are failing. From what I can seem it seems that calling project1.preset.getMany()
returns the presets corresponding to the config that I load later (completeConfig.zip
instead of defaultconfig.mapeoconfig
), which is weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that is related to assertions running in an unexpected order and solved in the last commit
from what I can gather looking at the logs, it seems that there are a bunch of tests failing given that now there are a bunch new records loaded from the default config. |
Sorry I'm just now reviewing this!
I think we should fix the tests in this PR. I like Gregor's idea of a test helper function. Does that seem reasonable? |
yeah yeah, I've already created that. I think it may be just a matter of updating expected assertions by merging the current expected outcome with the default config records. That's at least what I'll try to do. |
additionally * rollback changes in e2e since be can skip loading a config * create `getExpectedConfig` helper in `test-e2e/utils.js`
After a short sync with gregor, we decided to add a |
this should close #402