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

Update file structure and example functions and corresponding test files #418

Open
wants to merge 2 commits into
base: main
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
13 changes: 4 additions & 9 deletions src/domUpdates.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
//NOTE: Your DOM manipulation will occur in this file

//Here are 2 example functions just to demonstrate one way you can export/import between the two js files. You'll want to delete these once you get your own code going.
const exampleFunction1 = (person) => {
console.log(`oh hi there ${person}`)
}

const exampleFunction2 = (person) => {
console.log(`bye now ${person}`)
//Here is an example function just to demonstrate one way you can export/import between the two js files.
const displayUserInfo = () => {
console.log('Displaying user info now!')
}


export {
exampleFunction1,
exampleFunction2,
displayUserInfo,
}
5 changes: 5 additions & 0 deletions src/hydration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//Here is another example demonstrating hydration logic separated that can be imported into the scripts and test files. Feel free to update this later!

export const findAvgFluidOunces = userID => {
console.log('Finding average fluid ounces.')
}
17 changes: 11 additions & 6 deletions src/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@


// An example of how you tell webpack to use a CSS file
import './css/styles.css';
import './styles.css';
import apiCalls from './apiCalls'

// An example of how you tell webpack to use an image (also need to link to it in the index.html)
import './images/turing-logo.png';

// An example of how you tell webpack to use a JS file
import userData from './data/users';
console.log("User Data:", userData);

// Example of one way to import functions from the domUpdates file. You will delete these examples.
import { exampleFunction1, exampleFunction2 } from './domUpdates';
// Below are examples of how you can import functions from either users, hydration, or domUpdates files.
import { findUser } from './users'
import { findAvgFluidOunces } from './hydration';
import { displayUserInfo } from './domUpdates';

console.log("User Data:", userData);

exampleFunction1('Travis');
exampleFunction2('Travis')
findUser(12)
findAvgFluidOunces(12);
displayUserInfo();
File renamed without changes.
5 changes: 5 additions & 0 deletions src/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//Here is an example demonstrating logic separated that can be imported into the scripts and test files. Feel free to update this later!

export const findUser = userID => {
console.log(userID)
}
3 changes: 2 additions & 1 deletion test/UserRepository-test.js → test/users-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect } from 'chai';
import { findUser } from '../src/users';

describe('User Repository', () => {
it('should run tests', function () {
expect(true).to.be(true);
expect(findUser).to.be.a('function');
});
});