Created
August 22, 2020 15:13
-
-
Save shiqimei/db734a87c5b96e96eca5bea32537ab60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const range = (m, n) => Array(n).fill().map((_, i) => i+1).slice(m-1); | |
const expect = (input) => ({ | |
toEqual(expected) { | |
const { stringify } = JSON; | |
if (stringify(expected) !== stringify(input)) { | |
throw Error(`expect ${expected} while ${input}`); | |
} else { | |
console.info('Pass'); | |
} | |
} | |
}); | |
expect(range(1, 2)).toEqual([1, 2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment