GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — pjs-problems/tests/problems.test.js at master · PracticeJavaScript/pjs-problems Expand file tree/ Copy pathproblems.test.jsMore file actions 70 lines (63 loc) · 1.93 KB / Copy pathproblems.test.jsFile metadata and controls70 lines (63 loc) · 1.93 KB 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 // PROBLEMS-TEST // -------------------------------------------------------------------------------- // Test that the problems repo has imported properly, // and that it's in the format we expect import problems from '../index' import is from 'is' test('problems must be importable', () => { expect(problems).toBeDefined() }) test('problems must be an object', () => { expect(is.object(problems)).toBe(true) }) test('problems direct children attribute values must be non-empty arrays', () => { Object.entries(problems).map(item => { // is valid array expect(is.array(item[1])).toBe(true) // has more than zero items expect(item[1].length).toBeGreaterThan(0) }) }) test('problems must each have the required attributes', () => { Object.entries(problems).map(item => { item[1].forEach(problem => { // name expect(problem.name).toBeTruthy() expect(is.string(problem.name)).toBe(true) // prompt expect(problem.prompt).toBeTruthy() expect(is.string(problem.prompt)).toBe(true) // given expect(problem.given).toBeTruthy() expect(is.string(problem.given)).toBe(true) // tests expect(problem.tests).toBeTruthy() expect(is.array(problem.tests)).toBe(true) }) }) }) test('problems tests must non-empty array', () => { Object.entries(problems).map(item => { item[1].forEach(problem => { // tests // is array expect(is.array(problem.tests)).toBe(true) // non-empty expect(problem.tests.length).toBeGreaterThan(0) }) }) }) test('problems tests must each have the required attributes', () => { Object.entries(problems).map(item => { item[1].forEach(problem => { problem.tests.forEach(test => { // name expect(test.name).toBeTruthy() expect(is.string(test.name)).toBe(true) // test expect(test.test).toBeTruthy() expect(is.string(test.test)).toBe(true) }) }) }) }) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |