Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('syntax', () => {
- it('knows primitives', () => {
- expect(typeof String()).toBe(); // FIXME
- expect(typeof Date()).toBe(); // FIXME
- expect(typeof new Date()).toBe(); // FIXME
- expect(typeof Symbol()).toBe(); // FIXME
- expect(typeof new Error()).toBe(); // FIXME
- expect(typeof Error).toBe(); // FIXME
- expect(typeof Set).toBe(); // FIXME
- expect(typeof WeakMap).toBe(); // FIXME
- expect(typeof Iterable).toBe(); // FIXME
- expect(typeof Int32Array).toBe(); // FIXME
- });
- it('copes with objects', () => {
- let obj = { hello: 'Hello' }, hello = 'Hello';
- obj[hello] += ','
- obj.hello += ' world';
- obj['hello'] += '!';
- expect(obj['hello']).toBe(); // FIXME
- });
- it('knows its json', () => {
- let myObj = {
- a : 'A',
- b : 'B',
- c : {
- d : 'D',
- e : 'E',
- f : {
- g : 'G'
- },
- h : 'H'
- }
- };
- let { c : { f : { g : foo }, e : baz, b : bar } } = myObj;
- expect(foo).toBe(); // FIXME
- expect(baz).toBe(); // FIXME
- expect(bar).toBe(); // FIXME
- });
- it('knows arrays', () => {
- var arr = ['Pierre', 'Paul', 'Jacques'];
- expect(arr.join(', ')).toBe(); // FIXME
- arr.push('Jean');
- expect(arr[0]).toBe(); // FIXME
- expect(arr.length).toBe(); // FIXME
- });
- it('knows portability', () => {
- let a = 1, b = 2, c = {one: 1};
- const fun = () => {
- a = 11;
- let b = 22;
- c.two = 2;
- }
- fun();
- expect(a).toBe(); // FIXME
- expect(b).toBe(); // FIXME
- expect(c.one).toBe(); // FIXME
- expect(c.two).toBe(); // FIXME
- function Prefixer(prefix) {
- this.prefix = prefix;
- }
- Prefixer.prototype.prefixArray = function (arr) {
- return arr.map(function (x) {
- return this.prefix + x;
- });
- };
- var arr = new Prefixer('a').prefixArray([0,1,2]);
- expect(arr[0]).toEqual(); // FIXME
- });
- it('knows maps, filters and reduces', () => {
- expect([
- { name:'Lisa' , mark:'16' },
- { name:'Pascal' , mark:'13' },
- { name:'Romain' , mark:'12' },
- { name:'Lucas' , mark:'4' },
- { name:'Aurélie' , mark:'14' }
- ]
- .map(function(student) { student.mark = Number(student.mark); return student })
- .filter(function(student) { return student.mark >= 10 })
- .reduce(function(acc, student) { return student.mark + acc }, 0)).toBe(); // FIXME
- });
- it('knows functions', () => {
- function laugh() {
- return
- {
- ha: 'Haha!'
- }
- }
- expect(laugh()).toBe(); // FIXME
- });
- describe('setTimeout', () => {
- jasmine.clock().install();
- let buf = '';
- const funcs = {
- A : () => { buf += 'A'; },
- B : () => { buf += 'B'; },
- C : () => { buf += 'C'; },
- D : () => { buf += 'D'; }
- };
- it('knows what execution order means', () => {
- ['A','B','C','D'].forEach((letter, index) => {
- setTimeout(funcs[letter], index * 10);
- });
- jasmine.clock().tick(101);
- expect(buf).toBe(); // FIXME
- });
- });
- describe('class', () => {
- it('is George Abitbol', () => {
- class FooClass {
- constructor() {
- this.a = 'foo';
- return this;
- }
- static a() {
- return 'bar';
- }
- }
- class BarClass extends FooClass {
- constructor() {
- return [super(), super.a, this.a];
- }
- }
- const bar = new BarClass();
- expect(bar[1]).toBe(); // FIXME
- expect(bar[2]).toBe(); // FIXME
- });
- });
- describe('date', () => {
- it('knows about UTC', () => {
- let dateFields = [1970, 0, 1]; // 1 Jan 1970
- expect('Thu, 01 Jan 1970 00:00:00 GMT')
- .toEqual(); // FIXME
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement