fix(view, viewmodel, service): use full file name as file identifier#1590
Conversation
170abe1 to
7a37b52
Compare
| testing: testing, | ||
| ); | ||
|
|
||
| if (!await cssFileIsLinked(content, '${file.name}.${file.ext.name}')) { |
There was a problem hiding this comment.
file.ext is the Ext enum.
Changing this line to use getFullFileName would mean changing file.ext.name to file.ext.value. This isn't an issue as they return the same string.
mobile/mobile-app/lib/enums/ext_type.dart
Lines 1 to 6 in 915598f
| String getFullFileName(ChallengeFile file) { | ||
| return '${file.name}.${file.ext.value}'; | ||
| } |
There was a problem hiding this comment.
I defined this function 3 times, so I was tempted to make it a global util. But the function is too small that I don't know if it's really necessary, also I'm not sure where the util file should be if we were to create it.
7a37b52 to
fbcc8a0
Compare
| await prefs.remove('${currChallenge.id}.${getFullFileName(file)}'); | ||
| await prefs.remove('${currChallenge.id}${getFullFileName(file)}'); |
There was a problem hiding this comment.
I was going to ask about this.
I'm not sure if prefs.remove('${currChallenge.id}${file.name}'); is a mistake here or it's intended. I don't think I've seen prefs.set with this pattern.
There was a problem hiding this comment.
I think that might be some kind of artifact. Not sure.
There was a problem hiding this comment.
We need to check and remove it if there's no preference with that key
Checklist:
mainbranch of the repo.This PR:
[fileName].[fileExtension]instead of just file name. This is to ensure the uniqueness as React challenges can have bothindex.jsxandindex.htmlTesting
I've tested and verified the following cases:
React coding challenges are now accessible, file selection drowdown displays correctly
Screenshot
Challenge reset is working as expected
The file content are saved and retrieved correctly as expected
Tests run on HTML, CSS, JS challenges correctly as expected
But...
The tests fail on React challenges. It seems the user's code isn't passed to the tests. The tests can't see the code change and just run against the seed code.
I'm not sure if this is related to the test runner integration or if I'm missing something obvious.
Feel free to push changes to the PR to speed things up.