Closed atherdon closed 5 years ago
if you'll do it quickly and i will reply slow, you can also grab this image as well(each data should have separated file): https://github.com/ChickenKyiv/awesome-food-measurements-information/blob/master/images/c7cddf12c4969f80c77cd23d6d38243c.jpg
Next stage will be to add tests for each new file
may you say how to do this, please?
just similar to your previous task:
__tests__
i want to know how to change import of data?
how to trace files?
is there any folder or JSON file?
or just to trace import
....from
GroceriStar/sd/and file name?
hi, @atherdon what we need to do now? is there any task for me?
@elnur004 I suppose you need to generate files. See how to generate it in https://github.com/GroceriStar/sd/issues/55#issuecomment-484837676 or in https://github.com/GroceriStar/sd#how-to-generate-additional-files
@vadim I don't want to generate them :( please explain it to Elnur and follow him at this task
@elnur004
i want to know how to change import of data? how to trace files? is there any folder or JSON file? or just to trace import....from GroceriStar/sd/and file name?
Have you copy paste data from another test files? If yes, then for example allergy.test.js has import
import allergies from '~/Allergy/allergies.json'
~
this symbol cut path(instead of this symbol babel add ./src/data), full path to file without this symbol will be
import allergies from './src/data/Allergy/allergies.json'
change this '~/Allergy/allergies.json' on your path that you have saved your file then change variable of import in example it allergies.
@vadim9999 for instance: i've done files like this way import dash from '~/GroceriStar/cd/dash.js'
already.
and so on other files... (they exist in test folder)
if that way is correct let me know please, what to do then on?
@atherdon it's task is done for elnur?
if you'll do it quickly and i will reply slow, you can also grab this image as well(each data should have separated file): https://github.com/ChickenKyiv/awesome-food-measurements-information/blob/master/images/c7cddf12c4969f80c77cd23d6d38243c.jpg
@elnur004 Sorry for long reply I was very bussy. have you done this ?
hi, @vadim9999 no problem. yes, i've done this and they exist in task folder
@elnur004 Can you give me a link of file where you converted data from image into object I can find it
@atherdon tests doesn't work when using es6 import, working when using es5 require
@vadim9999 https://github.com/GroceriStar/sd/tree/master/src/data/__tests__ these are tests files
@elnur004 Can you give me a link of file where you converted data from image into object I can find it
@vadim9999 https://github.com/ChickenKyiv/awesome-food-measurements-information
@vadim9999 need we change these to es5?
@vadim9999 need we change these to es5?
No, I have fix this please update your local repository
@vadim9999 No, I have fix this please update your local repository
sorry for question. but how to update local repository?
@elnur004 All of objects that you have added in root directory cooking-times.js, cup1-2.js .. etc. Now doesn't work because it's haven't exported. and tests because it's import is incorrect. I For example I will take dash.js and dash.test.js To fix this you need
export default dash;
import dash from '~/GroceriStar/cd/dash.js'
It's doesn't work because this path doesn't exist. You need make this
import dash from '../../../dash'
../ this means that like "exit" from current folder for example you have this directory main |_ subfolder |_files.js |_manyfiles.js to open file manyfiles.js in folder main you will need use '../manyfyles' in files.js that is subfolder of main Make this changes for other files that you have added
@vadim9999 No, I have fix this please update your local repository
sorry for question. but how to update local repository?
you just need in your project use
git pull https://github.com/GroceriStar/sd.git
@vadim9999
i stuck in cooking-times.js/cooking-times here.
how i have to trace here?
must i import cooking-times from in cooking-times.js file?
for example:
import cooking-times from '../cd/cooking-times.js'
is this a correct tracking?
i want to understand from where we import the test
@elnur004 we have tests in sd/src/data/tests sd is a folder project object cooking-times.js is in sd, also other objects is in this folder in cooking-times.js you have exported object that we can get access to it from other files
then, i have to trace import cooking-times from '../src/data/tests/cooking-times.js' right?
@elnur004 but why you need to import tests? you need in file tests import object
@elnur004 if you will write in dash.test.js import dash from '../../../dash'
this will work another variant doesn't work. in cooking-times.js import like below and change instead of dash cooking-times.js in result you import will be
import cooking-times from '../../../cooking-times'
i want to fill up that dots)) before the /cooking-times i don't know to show cooking-times.js or not
i have stuck in there
just insert import
import cooking-times from '../../../cooking-times'
it will work
import cooking-times from '../src/data/tests/cooking-times'
like this?
no in cooking-times.test.js insert
import cooking-times from '../../../cooking-times'
don't fiil up dots
@vadim9999 may you explain please, why those dots wouldn't be filled up? it has been obscure for me
ok, for example now you are in folder tests you need to get access to file that located in folder up to get access you should use ../ . if need to get access upper folder in result it will be ../../
./ it get access to files that located in current folder but if you want to get file that located out of current folder using ../
now you are in sd/src/data/tests using ./ you can get files related in folder tests. to get files related in data
folder use ../ and if you want use files that located in folder srs use ../../ then if you want to get files from project folder ../../../
thanx, a lot @vadim9999 , it was very helpful for me
@elnur004 Sorry I thouhgt in file cooking-times.js is one object. change export default cooking-time on this structure
export {
frenchBeans,
sprouts,
//..and so on add all object in this curl brackets that are in this files
}
and change import in cooking-times.test.js instead of
import { frenchBeans, sprouts} from '../../../cooking-times'
ok
need there to write default
after export
?
no
why? what is the difference between previous and this?
export default when you export one object and export { .. } some objects
i've caught it up but i want to grasp what is the meaning of default in here?
sorry i'm giving you trouble
more information you can read in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
add more tests in block describe https://github.com/GroceriStar/sd/blob/master/src/data/__tests__/cooking_times.test.js
https://github.com/ChickenKyiv/awesome-food-measurements-information/blob/master/images/cooking-guide-apron-cu-cooking-times.jpg
@elnur004 you can grab it