-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,462 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"presets": ["@babel/preset-env"], | ||
"env": { | ||
"test": { | ||
"presets": ["@babel/preset-env"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ class App extends Component { | |
} | ||
console.log(this.state); | ||
} | ||
|
||
state = { | ||
redirect: "", | ||
userID: "", | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//import { render, screen } from '@testing-library/react'; | ||
//import CountBox from 'src/components/home pages/count' | ||
//const App = require('./App.js') | ||
import CountBox from './count.js'; | ||
import React from 'react'; | ||
import { Enzyme, EnzymeAdapter, shallow} from 'enzyme'; | ||
import {configure} from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
|
||
configure({adapter: new Adapter() }); | ||
|
||
describe('<CountBox />', () => { | ||
it('Checking count getdata',async () => { | ||
const wrapper = shallow(<CountBox />); | ||
const instance=wrapper.instance(); | ||
var orgdata=wrapper.state().count; | ||
var c=0; | ||
for(var key in orgdata) | ||
if(orgdata[key]===0) | ||
c++; | ||
expect(c).toBe(3); | ||
localStorage.setItem('userID',"jFRWF4kP5HfyPNgDyJUiG83Oc8k1"); | ||
await instance.getdata(); | ||
var data=wrapper.state().count; | ||
var c=0; | ||
for(var key in data) | ||
c++; | ||
expect(c).toBe(3); | ||
localStorage.clear(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Header from "./header.js"; | ||
import React from "react"; | ||
import { Enzyme, EnzymeAdapter, shallow } from "enzyme"; | ||
import { configure } from "enzyme"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
|
||
configure({ adapter: new Adapter() }); | ||
|
||
describe("<Header />", () => { | ||
it("Checking roll number getdata", async () => { | ||
const wrapper = shallow(<Header.WrappedComponent />); | ||
const instance = wrapper.instance(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("Loading..."); | ||
localStorage.setItem("userID", "jFRWF4kP5HfyPNgDyJUiG83Oc8k1"); | ||
await instance.getdata(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("cb.en.u4cse18135"); | ||
localStorage.clear(); | ||
}); | ||
}); | ||
|
||
describe("<Header />", () => { | ||
it("Checking roll number getdata", async () => { | ||
const wrapper = shallow(<Header.WrappedComponent />); | ||
const instance = wrapper.instance(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("Loading..."); | ||
localStorage.setItem("userID", "Aaaoa9S8vLOR1DzkpanCcNaMH3G3"); | ||
await instance.getdata(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("Guest User"); | ||
localStorage.clear(); | ||
}); | ||
}); | ||
|
||
describe("<Header />", () => { | ||
it("Checking roll number getdata", async () => { | ||
const wrapper = shallow(<Header.WrappedComponent />); | ||
const instance = wrapper.instance(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("Loading..."); | ||
localStorage.setItem("userID", "UwkudJJO1HO7Z50pOGgI7ODcPhw1"); | ||
await instance.getdata(); | ||
var orgdata = wrapper.state().roll_no; | ||
expect(orgdata).toBe("ADMIN"); | ||
localStorage.clear(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import Lecture_card from "./lecture_card.js"; | ||
import React from "react"; | ||
import { Enzyme, EnzymeAdapter, shallow } from "enzyme"; | ||
import { configure } from "enzyme"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
|
||
configure({ adapter: new Adapter() }); | ||
window.scrollTo = jest.fn(); | ||
describe("<Lecture_card />", () => { | ||
it("Checking movement to next page", () => { | ||
const historyMock = { push: jest.fn() }; | ||
const wrapper = shallow( | ||
<Lecture_card.WrappedComponent | ||
history={historyMock} | ||
setDataLecture={jest.fn()} | ||
details={{ | ||
regcount: "100", | ||
poster: | ||
"https://i2.wp.com/psychlearningcurve.org/wp-content/uploads/2019/12/skills.png?fit=1000%2C563", | ||
organizer: "Amrita Vishwa Vidhyapeetam", | ||
title: "Introduction to Psychology", | ||
about: | ||
"What are people most afraid of? What do our dreams mean? Are we natural-born racists? What makes us happy? What are the causes and cures of mental illness? This course tries to answer these questions and many others, providing a comprehensive overview of the scientific study of thought and behavior. It explores topics such as perception, communication, learning, memory, decision-making, persuasion, emotions, and social behavior. We will look at how these aspects of the mind develop in children, how they differ across people, how they are wired-up in the brain, and how they break down due to illness and injury.", | ||
syllabus: [ | ||
"Welcome to Introduction to Psychology", | ||
"Foundations", | ||
"Development and Language", | ||
"Cognition", | ||
"Self and others", | ||
], | ||
requirements: ["All", "Every year", "None"], | ||
fee: "300", | ||
instructor: { | ||
name: "Dr. Gitanjali Natarajan", | ||
img: | ||
"https://www.amrita.edu/sites/default/files/styles/260x160/adaptive-image/public/faculty_images/gitanjali-n.jpg?itok=e2mmhRHV", | ||
position: "Licensed Clinical Psychologist", | ||
}, | ||
geoinfo: { | ||
stdate: "2021/04/03", | ||
eddate: "2021/04/05", | ||
sttime: "09:00", | ||
edtime: "11:00", | ||
venue: "AB-1,Lecture hall-3", | ||
certificate: "E-Certificate", | ||
}, | ||
lecture_id: "5", | ||
registered: [ | ||
"ujGl7FVouFh2r75cWeRvEqj6CQR2", | ||
"cO77kwy785eXoSeoVgXgr81T3cq1", | ||
], | ||
}} | ||
/> | ||
); | ||
const instance = wrapper.instance(); | ||
expect(instance.openLecture()).toBe("success"); | ||
}); | ||
}); | ||
|
||
describe("<Lecture_card />", () => { | ||
it("Checking movement to next page", () => { | ||
const historyMock = { push: jest.fn() }; | ||
const wrapper = shallow( | ||
<Lecture_card.WrappedComponent | ||
history={historyMock} | ||
setDataLecture={jest.fn()} | ||
details={{ | ||
poster: | ||
"https://t3.ftcdn.net/jpg/02/66/33/82/360_F_266338299_wTr8tcMGNmjFbEJVnrkKXrrsHABMlqXY.jpg", | ||
title: "No Lectures to display right now!", | ||
geoinfo: { | ||
stdate: "", | ||
eddate: "", | ||
sttime: "", | ||
edtime: "", | ||
venue: "", | ||
}, | ||
}} | ||
/> | ||
); | ||
const instance = wrapper.instance(); | ||
expect(instance.openLecture()).toBe("failure"); | ||
}); | ||
}); | ||
|
||
describe("<Lecture_card />", () => { | ||
it("Checking movement to next page", () => { | ||
const historyMock = { push: jest.fn() }; | ||
const wrapper = shallow( | ||
<Lecture_card.WrappedComponent | ||
history={historyMock} | ||
setDataLecture={jest.fn()} | ||
details={{ | ||
regcount: "100", | ||
poster: | ||
"https://i2.wp.com/psychlearningcurve.org/wp-content/uploads/2019/12/skills.png?fit=1000%2C563", | ||
organizer: "Amrita Vishwa Vidhyapeetam", | ||
title: "Introduction to Psychology", | ||
about: | ||
"What are people most afraid of? What do our dreams mean? Are we natural-born racists? What makes us happy? What are the causes and cures of mental illness? This course tries to answer these questions and many others, providing a comprehensive overview of the scientific study of thought and behavior. It explores topics such as perception, communication, learning, memory, decision-making, persuasion, emotions, and social behavior. We will look at how these aspects of the mind develop in children, how they differ across people, how they are wired-up in the brain, and how they break down due to illness and injury.", | ||
syllabus: [ | ||
"Welcome to Introduction to Psychology", | ||
"Foundations", | ||
"Development and Language", | ||
"Cognition", | ||
"Self and others", | ||
], | ||
requirements: ["All", "Every year", "None"], | ||
fee: "300", | ||
instructor: { | ||
name: "Dr. Gitanjali Natarajan", | ||
img: | ||
"https://www.amrita.edu/sites/default/files/styles/260x160/adaptive-image/public/faculty_images/gitanjali-n.jpg?itok=e2mmhRHV", | ||
position: "Licensed Clinical Psychologist", | ||
}, | ||
geoinfo: { | ||
stdate: "2021/04/03", | ||
eddate: "2021/04/05", | ||
sttime: "09:00", | ||
edtime: "11:00", | ||
venue: "AB-1,Lecture hall-3", | ||
certificate: "E-Certificate", | ||
}, | ||
lecture_id: "5", | ||
registered: [ | ||
"ujGl7FVouFh2r75cWeRvEqj6CQR2", | ||
"cO77kwy785eXoSeoVgXgr81T3cq1", | ||
], | ||
}} | ||
/> | ||
); | ||
const instance = wrapper.instance(); | ||
instance.openLecture(); | ||
expect(global.scrollTo).toHaveBeenCalledWith(0, 0); | ||
}); | ||
}); |