All files / test/helpers index.js

96.61% Statements 114/118
100% Branches 0/0
88.57% Functions 31/35
100% Lines 84/84

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325  37x   37x 414x 414x 414x 414x 414x 414x 414x 414x 414x 414x 414x 414x 414x     37x       37x       37x       37x       94x 87x 37x 37x   37x         37x         73x   66x   37x         37x         75x   68x   37x       65x   37x       61x   37x       37x   37x       37x   37x       37x   37x                   42x   37x                   39x   37x                   37x   37x                   40x   37x                   37x   37x                   37x     37x         37x   37x         37x   37x         37x   37x         37x   37x         37x   37x         37x   37x           37x   37x           37x   37x           37x   37x           37x   37x           37x   37x           37x   37x           37x   37x             37x   37x             37x   37x                                                                          
/* eslint-disable max-len */
const db = require("../../database/connection");
 
const clearDatabase = async () => {
    await db.query("DELETE FROM course_phase");
    await db.query("DELETE FROM video_phase");
    await db.query("DELETE FROM course");
    await db.query("DELETE FROM video");
    await db.query("DELETE FROM phase");
    await db.query("DELETE FROM competency");
    await db.query("DELETE FROM category");
    await db.query("DELETE FROM capability");
    await db.query("DELETE FROM information");
    await db.query("DELETE FROM faq");
    await db.query("DELETE FROM learning_object");
    await db.query("DELETE FROM submission");
    await db.query("DELETE FROM admin");
};
 
const capability1 = {
    title: "Domain A: Knowledge and intellectual abilities",
};
 
const capability2 = {
    title: "Domain B: Personal effectiveness",
};
 
const capability3 = {
    title: "Domain C",
};
 
const capability4 = {
    title: "Domain D",
};
 
const getCapability1 = () => ({...capability1});
const getCapability2 = () => ({...capability2});
const getCapability3 = () => ({...capability3});
const getCapability4 = () => ({...capability4});
 
const category1 = {
    title: "A1 Knowledge base",
    capabilityId: -1,
};
 
const category2 = {
    title: "B1 Second category",
    capabilityId: -1,
};
 
const getCategory1 = () => ({...category1});
 
const getCategory2 = () => ({...category2});
 
const competency1 = {
    title: "A1: 1. Subject knowledge",
    categoryId: -1,
};
 
const competency2 = {
    title: "B1: 1. Second competency",
    categoryId: -1,
};
 
const getCompetency1 = () => ({...competency1});
 
const getCompetency2 = () => ({...competency2});
 
const phase1 = {
    title: "Phase 1",
};
 
const getPhase1 = () => ({...phase1});
 
const phase2 = {
    title: "Phase 2",
};
 
const getPhase2 = () => ({...phase2});
 
const phase3 = {
    title: "Phase 3",
};
 
const getPhase3 = () => ({...phase3});
 
const phase4 = {
    title: "Phase 4",
};
 
const getPhase4 = () => ({...phase4});
 
const phase5 = {
    title: "Phase 5",
};
 
const getPhase5 = () => ({...phase5});
 
const course1 = {
    title: "Researcher Development and Doctoral Skills Development",
    hyperlink: "https://www.linkedin.com/learning/academic-research-foundations-quantitative?u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getCourse1 = () => ({...course1});
 
const course2 = {
    title: "Writing a Research Paper",
    hyperlink: "https://www.linkedin.com/learning/writing-a-research-paper?u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getCourse2 = () => ({...course2});
 
const course3 = {
    title: "SPSS for Academic Research",
    hyperlink: "https://www.linkedin.com/learning/spss-for-academic-research?u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getCourse3 = () => ({...course3});
 
const video1 = {
    title: "Research & Development",
    hyperlink: "https://www.linkedin.com/learning/writing-a-research-paper/researching-the-topic?collection=urn%3Ali%3AlearningCollection%3A6605689868850995200&u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getVideo1 = () => ({...video1});
 
const video2 = {
    title: "Research ethics",
    hyperlink: "https://www.linkedin.com/learning/academic-research-foundations-quantitative/research-ethics?collection=urn%3Ali%3AlearningCollection%3A6605689868850995200&u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getVideo2 = () => ({...video2});
 
const video3 = {
    title: "Researching the topic",
    hyperlink: "https://www.linkedin.com/learning/writing-a-research-paper/researching-the-topic?collection=urn%3Ali%3AlearningCollection%3A6605689868850995200&u=104",
    capabilityId: -1,
    categoryId: -1,
    competencyId: -1,
    phases: [], // can be multiple IDs
    urn: "null",
};
 
const getVideo3 = () => ({...video3});
 
 
const information1 = {
    type: "privacy",
    content: "We don't sell your data.",
};
 
const getInformation1 = () => ({...information1});
 
const information2 = {
    type: "accessibility",
    content: "Screen readers are supported",
};
 
const getInformation2 = () => ({...information2});
 
const faq1 = {
    question: "Why does this not work?",
    answer: "You are using it the opposite way.",
};
 
const getFAQ1 = () => ({...faq1});
 
const faq2 = {
    question: "Do I need a LinkedIn Learning licence?",
    answer: "Yes.",
};
 
const getFAQ2 = () => ({...faq2});
 
const learningObject1 = {
    urn: 'urn:li:lyndaCourse:158319',
    data: `{"urn":"urn:li:lyndaCourse:158319","title":{"value":"Writing a Research Paper"},"details":{"urls":{"webLaunch":"https://www.linkedin.com/learning/writing-a-research-paper"},"images":{"primary":"https://cdn.lynda.com/course/158319/158319-636456674755623334-16x9.jpg"},"timeToComplete":{"duration":6962},"descriptionIncludingHtml":{"value":"Have to write a research paper? Learn tips for writing an A+ paper that will wow your professors. In this course, author and Kelley School of Business faculty member Judy Steiner-Williams shows you how to prepare for, and write, polished research papers for high school and college classes. Discover how to brainstorm, select your best ideas, collect and categorize research, and write the paper, while following along with Judy's practical, real-world examples."},"shortDescriptionIncludingHtml":{"value":"Discover how to write research papers for high school and college classes."}}}`,
};
 
const getLearningObject1 = () => ({...learningObject1});
 
const learningObject2 = {
    urn: 'urn:li:lyndaCourse:476938',
    data: `{"urn":"urn:li:lyndaCourse:158319","title":{"value":"Writing a Research Paper"},"details":{"urls":{"webLaunch":"https://www.linkedin.com/learning/writing-a-research-paper"},"images":{"primary":"https://cdn.lynda.com/course/158319/158319-636456674755623334-16x9.jpg"},"timeToComplete":{"duration":6962},"descriptionIncludingHtml":{"value":"Have to write a research paper? Learn tips for writing an A+ paper that will wow your professors. In this course, author and Kelley School of Business faculty member Judy Steiner-Williams shows you how to prepare for, and write, polished research papers for high school and college classes. Discover how to brainstorm, select your best ideas, collect and categorize research, and write the paper, while following along with Judy's practical, real-world examples."},"shortDescriptionIncludingHtml":{"value":"Discover how to write research papers for high school and college classes."}}}`,
};
 
const getLearningObject2 = () => ({...learningObject2});
 
const outdatedLearningObject1 = {
    urn: 'urn:li:lyndaCourse:476938',
    timestamp: `2020-01-28T11:33:52.000Z`,
    data: `{"urn":"urn:li:lyndaCourse:158319","title":{"value":"Writing a Research Paper"},"details":{"urls":{"webLaunch":"https://www.linkedin.com/learning/writing-a-research-paper"},"images":{"primary":"https://cdn.lynda.com/course/158319/158319-636456674755623334-16x9.jpg"},"timeToComplete":{"duration":6962},"descriptionIncludingHtml":{"value":"Have to write a research paper? Learn tips for writing an A+ paper that will wow your professors. In this course, author and Kelley School of Business faculty member Judy Steiner-Williams shows you how to prepare for, and write, polished research papers for high school and college classes. Discover how to brainstorm, select your best ideas, collect and categorize research, and write the paper, while following along with Judy's practical, real-world examples."},"shortDescriptionIncludingHtml":{"value":"Discover how to write research papers for high school and college classes."}}}`,
};
 
const getOutdatedLearningObject1 = () => ({...outdatedLearningObject1});
 
const submission1 = {
    status: 'processing',
    submitter: 'test@test.com',
    data: `{"type":"COURSE","title":"Business Development Foundations: Researching Market and Customer Needs","phases":"5","category":"10","hyperlink":"https://www.linkedin.com/learning/business-development-foundations-researching-market-and-customer-needs/welcome?u=104","timestamp":"Sat, 22 Aug 2020 23:30:01 GMT","capability":"4","competency":"48","categoryTitle":"D1: Working with others","capabilityTitle":"D: Engagement, influence and impact","competencyTitle":"Team working"}`,
};
 
const getSubmission1 = () => ({...submission1});
 
const submission12 = {
    status: 'processing',
    submitter: 'anonymous',
    data: `{"type":"COURSE","title":"Business Development Foundations: Researching Market and Customer Needs","phases":"5","category":"10","hyperlink":"https://www.linkedin.com/learning/business-development-foundations-researching-market-and-customer-needs/welcome?u=104","timestamp":"Sat, 22 Aug 2020 23:30:01 GMT","capability":"4","competency":"48","categoryTitle":"D1: Working with others","capabilityTitle":"D: Engagement, influence and impact","competencyTitle":"Team working"}`,
};
 
const getSubmission12 = () => ({...submission12});
 
const submission2 = {
    status: 'pending',
    submitter: 'test@test.com',
    data: `{"urn":"urn:li:lyndaCourse:697710","type":"COURSE","title":"Business Development Foundations: Researching Market and Customer Needs","phases":"5","category":"10","hyperlink":"https://www.linkedin.com/learning/business-development-foundations-researching-market-and-customer-needs/welcome?u=104","timestamp":"Sat, 22 Aug 2020 23:30:01 GMT","capability":"4","competency":"48","categoryTitle":"D1: Working with others","capabilityTitle":"D: Engagement, influence and impact","competencyTitle":"Team working"}`,
};
 
const getSubmission2 = () => ({...submission2});
 
const submission3 = {
    status: 'published',
    submitter: 'test@test.com',
    data: `{"urn":"urn:li:lyndaCourse:697710","type":"COURSE","title":"Business Development Foundations: Researching Market and Customer Needs","phases":"5","hyperlink":"https://www.linkedin.com/learning/business-development-foundations-researching-market-and-customer-needs/welcome?u=104","timestamp":"Sat, 22 Aug 2020 23:30:01 GMT"}`,
};
 
const getSubmission3 = () => ({...submission3});
 
const submission4 = {
    status: 'failed',
    submitter: 'anonymous',
    data: `{"type":"COURSE","title":"1111111asdf","hyperlink":"asdfsdf","timestamp":"Sat, 22 Aug 2020 23:29:50 GMT"}`,
};
 
const getSubmission4 = () => ({...submission4});
 
const submission5 = {
    status: 'failed',
    submitter: 'anonymous',
    data: `{"type":"COURSE","title":"1111111asdf","hyperlink":"asdfsdf","timestamp":"Sat, 22 Aug 2020 23:29:50 GMT"}`,
};
 
const getSubmission5 = () => ({...submission5});
 
const admin1 = {
    email: 'admin@test.com',
    username: 'admin1',
    passwordHash: 'bd25f93e765c380a414d1cb7887a9cfcf5394fbc36443810256df3ce39f7ab32',
    salt: '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
};
 
const getAdmin1 = () => ({...admin1});
 
const admin2 = {
    email: 'admin2@test.com',
    username: 'admin2',
    passwordHash: 'bd25f93e765c380a414d1cb7887a9cfcf5394fbc36443810256df3ce39f7ab32',
    salt: '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8',
};
 
const getAdmin2 = () => ({...admin2});
 
module.exports = {
    clearDatabase,
    getCapability1,
    getCapability2,
    getCapability3,
    getCapability4,
    getCategory1,
    getCategory2,
    getCompetency1,
    getCompetency2,
    getPhase1,
    getPhase2,
    getPhase3,
    getPhase4,
    getPhase5,
    getCourse1,
    getCourse2,
    getCourse3,
    getVideo1,
    getVideo2,
    getVideo3,
    getInformation1,
    getInformation2,
    getFAQ1,
    getFAQ2,
    getLearningObject1,
    getLearningObject2,
    getOutdatedLearningObject1,
    getSubmission1,
    getSubmission12,
    getSubmission2,
    getSubmission3,
    getSubmission4,
    getSubmission5,
    getAdmin1,
    getAdmin2,
};