How to use then method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

transition.spec.js

Source:transition.spec.js Github

copy

Full Screen

...19 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')20 vm.ok = false21 waitForUpdate(() => {22 expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')23 }).thenWaitFor(nextFrame).then(() => {24 expect(vm.$el.children[0].className).toBe('test v-leave-active')25 }).thenWaitFor(duration + 10).then(() => {26 expect(vm.$el.children.length).toBe(0)27 vm.ok = true28 }).then(() => {29 expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')30 }).thenWaitFor(nextFrame).then(() => {31 expect(vm.$el.children[0].className).toBe('test v-enter-active')32 }).thenWaitFor(duration + 10).then(() => {33 expect(vm.$el.children[0].className).toBe('test')34 }).then(done)35 })36 it('named transition', done => {37 const vm = new Vue({38 template: '<div><transition name="test"><div v-if="ok" class="test">foo</div></transition></div>',39 data: { ok: true }40 }).$mount(el)41 // should not apply transition on initial render by default42 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')43 vm.ok = false44 waitForUpdate(() => {45 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')46 }).thenWaitFor(nextFrame).then(() => {47 expect(vm.$el.children[0].className).toBe('test test-leave-active')48 }).thenWaitFor(duration + 10).then(() => {49 expect(vm.$el.children.length).toBe(0)50 vm.ok = true51 }).then(() => {52 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')53 }).thenWaitFor(nextFrame).then(() => {54 expect(vm.$el.children[0].className).toBe('test test-enter-active')55 }).thenWaitFor(duration + 10).then(() => {56 expect(vm.$el.children[0].className).toBe('test')57 }).then(done)58 })59 it('custom transition classes', done => {60 const vm = new Vue({61 template: `62 <div>63 <transition64 enter-class="hello"65 enter-active-class="hello-active"66 leave-class="bye"67 leave-active-class="byebye active">68 <div v-if="ok" class="test">foo</div>69 </transition>70 </div>71 `,72 data: { ok: true }73 }).$mount(el)74 // should not apply transition on initial render by default75 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')76 vm.ok = false77 waitForUpdate(() => {78 expect(vm.$el.children[0].className).toBe('test bye byebye active')79 }).thenWaitFor(nextFrame).then(() => {80 expect(vm.$el.children[0].className).toBe('test byebye active')81 }).thenWaitFor(duration + 10).then(() => {82 expect(vm.$el.children.length).toBe(0)83 vm.ok = true84 }).then(() => {85 expect(vm.$el.children[0].className).toBe('test hello hello-active')86 }).thenWaitFor(nextFrame).then(() => {87 expect(vm.$el.children[0].className).toBe('test hello-active')88 }).thenWaitFor(duration + 10).then(() => {89 expect(vm.$el.children[0].className).toBe('test')90 }).then(done)91 })92 it('dynamic transition', done => {93 const vm = new Vue({94 template: `95 <div>96 <transition :name="trans">97 <div v-if="ok" class="test">foo</div>98 </transition>99 </div>100 `,101 data: {102 ok: true,103 trans: 'test'104 }105 }).$mount(el)106 // should not apply transition on initial render by default107 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')108 vm.ok = false109 waitForUpdate(() => {110 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')111 }).thenWaitFor(nextFrame).then(() => {112 expect(vm.$el.children[0].className).toBe('test test-leave-active')113 }).thenWaitFor(duration + 10).then(() => {114 expect(vm.$el.children.length).toBe(0)115 vm.ok = true116 vm.trans = 'changed'117 }).then(() => {118 expect(vm.$el.children[0].className).toBe('test changed-enter changed-enter-active')119 }).thenWaitFor(nextFrame).then(() => {120 expect(vm.$el.children[0].className).toBe('test changed-enter-active')121 }).thenWaitFor(duration + 10).then(() => {122 expect(vm.$el.children[0].className).toBe('test')123 }).then(done)124 })125 it('inline transition object', done => {126 const enter = jasmine.createSpy('enter')127 const leave = jasmine.createSpy('leave')128 const vm = new Vue({129 render (h) {130 return h('div', null, [131 h('transition', {132 props: {133 name: 'inline',134 enterClass: 'hello',135 enterActiveClass: 'hello-active',136 leaveClass: 'bye',137 leaveActiveClass: 'byebye active'138 },139 on: {140 enter,141 leave142 }143 }, this.ok ? [h('div', { class: 'test' }, 'foo')] : undefined)144 ])145 },146 data: { ok: true }147 }).$mount(el)148 // should not apply transition on initial render by default149 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')150 vm.ok = false151 waitForUpdate(() => {152 expect(vm.$el.children[0].className).toBe('test bye byebye active')153 expect(leave).toHaveBeenCalled()154 }).thenWaitFor(nextFrame).then(() => {155 expect(vm.$el.children[0].className).toBe('test byebye active')156 }).thenWaitFor(duration + 10).then(() => {157 expect(vm.$el.children.length).toBe(0)158 vm.ok = true159 }).then(() => {160 expect(vm.$el.children[0].className).toBe('test hello hello-active')161 expect(enter).toHaveBeenCalled()162 }).thenWaitFor(nextFrame).then(() => {163 expect(vm.$el.children[0].className).toBe('test hello-active')164 }).thenWaitFor(duration + 10).then(() => {165 expect(vm.$el.children[0].className).toBe('test')166 }).then(done)167 })168 it('transition events', done => {169 const onLeaveSpy = jasmine.createSpy('leave')170 const onEnterSpy = jasmine.createSpy('enter')171 const beforeLeaveSpy = jasmine.createSpy('beforeLeave')172 const beforeEnterSpy = jasmine.createSpy('beforeEnter')173 const afterLeaveSpy = jasmine.createSpy('afterLeave')174 const afterEnterSpy = jasmine.createSpy('afterEnter')175 const vm = new Vue({176 template: `177 <div>178 <transition179 name="test"180 @before-enter="beforeEnter"181 @enter="enter"182 @after-enter="afterEnter"183 @before-leave="beforeLeave"184 @leave="leave"185 @after-leave="afterLeave">186 <div v-if="ok" class="test">foo</div>187 </transition>188 </div>189 `,190 data: { ok: true },191 methods: {192 beforeLeave: (el) => {193 expect(el).toBe(vm.$el.children[0])194 expect(el.className).toBe('test')195 beforeLeaveSpy(el)196 },197 leave: (el) => onLeaveSpy(el),198 afterLeave: (el) => afterLeaveSpy(el),199 beforeEnter: (el) => {200 expect(vm.$el.contains(el)).toBe(false)201 expect(el.className).toBe('test')202 beforeEnterSpy(el)203 },204 enter: (el) => {205 expect(vm.$el.contains(el)).toBe(true)206 onEnterSpy(el)207 },208 afterEnter: (el) => afterEnterSpy(el)209 }210 }).$mount(el)211 // should not apply transition on initial render by default212 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')213 let _el = vm.$el.children[0]214 vm.ok = false215 waitForUpdate(() => {216 expect(beforeLeaveSpy).toHaveBeenCalledWith(_el)217 expect(onLeaveSpy).toHaveBeenCalledWith(_el)218 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')219 }).thenWaitFor(nextFrame).then(() => {220 expect(afterLeaveSpy).not.toHaveBeenCalled()221 expect(vm.$el.children[0].className).toBe('test test-leave-active')222 }).thenWaitFor(duration + 10).then(() => {223 expect(afterLeaveSpy).toHaveBeenCalledWith(_el)224 expect(vm.$el.children.length).toBe(0)225 vm.ok = true226 }).then(() => {227 _el = vm.$el.children[0]228 expect(beforeEnterSpy).toHaveBeenCalledWith(_el)229 expect(onEnterSpy).toHaveBeenCalledWith(_el)230 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')231 }).thenWaitFor(nextFrame).then(() => {232 expect(afterEnterSpy).not.toHaveBeenCalled()233 expect(vm.$el.children[0].className).toBe('test test-enter-active')234 }).thenWaitFor(duration + 10).then(() => {235 expect(afterEnterSpy).toHaveBeenCalledWith(_el)236 expect(vm.$el.children[0].className).toBe('test')237 }).then(done)238 })239 it('transition events (v-show)', done => {240 const onLeaveSpy = jasmine.createSpy('leave')241 const onEnterSpy = jasmine.createSpy('enter')242 const beforeLeaveSpy = jasmine.createSpy('beforeLeave')243 const beforeEnterSpy = jasmine.createSpy('beforeEnter')244 const afterLeaveSpy = jasmine.createSpy('afterLeave')245 const afterEnterSpy = jasmine.createSpy('afterEnter')246 const vm = new Vue({247 template: `248 <div>249 <transition250 name="test"251 @before-enter="beforeEnter"252 @enter="enter"253 @after-enter="afterEnter"254 @before-leave="beforeLeave"255 @leave="leave"256 @after-leave="afterLeave">257 <div v-show="ok" class="test">foo</div>258 </transition>259 </div>260 `,261 data: { ok: true },262 methods: {263 beforeLeave: (el) => {264 expect(el).toBe(vm.$el.children[0])265 expect(el.className).toBe('test')266 beforeLeaveSpy(el)267 },268 leave: (el) => onLeaveSpy(el),269 afterLeave: (el) => afterLeaveSpy(el),270 beforeEnter: (el) => {271 expect(el.className).toBe('test')272 beforeEnterSpy(el)273 },274 enter: (el) => {275 onEnterSpy(el)276 },277 afterEnter: (el) => afterEnterSpy(el)278 }279 }).$mount(el)280 // should not apply transition on initial render by default281 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')282 let _el = vm.$el.children[0]283 vm.ok = false284 waitForUpdate(() => {285 expect(beforeLeaveSpy).toHaveBeenCalledWith(_el)286 expect(onLeaveSpy).toHaveBeenCalledWith(_el)287 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')288 }).thenWaitFor(nextFrame).then(() => {289 expect(afterLeaveSpy).not.toHaveBeenCalled()290 expect(vm.$el.children[0].className).toBe('test test-leave-active')291 }).thenWaitFor(duration + 10).then(() => {292 expect(afterLeaveSpy).toHaveBeenCalledWith(_el)293 expect(vm.$el.children[0].style.display).toBe('none')294 vm.ok = true295 }).then(() => {296 _el = vm.$el.children[0]297 expect(beforeEnterSpy).toHaveBeenCalledWith(_el)298 expect(onEnterSpy).toHaveBeenCalledWith(_el)299 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')300 }).thenWaitFor(nextFrame).then(() => {301 expect(afterEnterSpy).not.toHaveBeenCalled()302 expect(vm.$el.children[0].className).toBe('test test-enter-active')303 }).thenWaitFor(duration + 10).then(() => {304 expect(afterEnterSpy).toHaveBeenCalledWith(_el)305 expect(vm.$el.children[0].className).toBe('test')306 }).then(done)307 })308 it('explicit user callback in JavaScript hooks', done => {309 let next310 const vm = new Vue({311 template: `<div>312 <transition name="test" @enter="enter" @leave="leave">313 <div v-if="ok" class="test">foo</div>314 </transition>315 </div>`,316 data: { ok: true },317 methods: {318 enter: (el, cb) => {319 next = cb320 },321 leave: (el, cb) => {322 next = cb323 }324 }325 }).$mount(el)326 vm.ok = false327 waitForUpdate(() => {328 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')329 }).thenWaitFor(nextFrame).then(() => {330 expect(vm.$el.children[0].className).toBe('test test-leave-active')331 }).thenWaitFor(duration + 10).then(() => {332 expect(vm.$el.children[0].className).toBe('test test-leave-active')333 expect(next).toBeTruthy()334 next()335 expect(vm.$el.children.length).toBe(0)336 }).then(() => {337 vm.ok = true338 }).then(() => {339 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')340 }).thenWaitFor(nextFrame).then(() => {341 expect(vm.$el.children[0].className).toBe('test test-enter-active')342 }).thenWaitFor(duration + 10).then(() => {343 expect(vm.$el.children[0].className).toBe('test test-enter-active')344 expect(next).toBeTruthy()345 next()346 expect(vm.$el.children[0].className).toBe('test')347 }).then(done)348 })349 it('css: false', done => {350 const enterSpy = jasmine.createSpy('enter')351 const leaveSpy = jasmine.createSpy('leave')352 const vm = new Vue({353 template: `354 <div>355 <transition :css="false" name="test" @enter="enter" @leave="leave">356 <div v-if="ok" class="test">foo</div>357 </transition>358 </div>359 `,360 data: { ok: true },361 methods: {362 enter: enterSpy,363 leave: leaveSpy364 }365 }).$mount(el)366 vm.ok = false367 waitForUpdate(() => {368 expect(leaveSpy).toHaveBeenCalled()369 expect(vm.$el.innerHTML).toBe('<!---->')370 vm.ok = true371 }).then(() => {372 expect(enterSpy).toHaveBeenCalled()373 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')374 }).then(done)375 })376 it('no transition detected', done => {377 const enterSpy = jasmine.createSpy('enter')378 const leaveSpy = jasmine.createSpy('leave')379 const vm = new Vue({380 template: '<div><transition name="nope" @enter="enter" @leave="leave"><div v-if="ok">foo</div></transition></div>',381 data: { ok: true },382 methods: {383 enter: enterSpy,384 leave: leaveSpy385 }386 }).$mount(el)387 vm.ok = false388 waitForUpdate(() => {389 expect(leaveSpy).toHaveBeenCalled()390 expect(vm.$el.innerHTML).toBe('<div class="nope-leave nope-leave-active">foo</div><!---->')391 }).thenWaitFor(nextFrame).then(() => {392 expect(vm.$el.innerHTML).toBe('<!---->')393 vm.ok = true394 }).then(() => {395 expect(enterSpy).toHaveBeenCalled()396 expect(vm.$el.innerHTML).toBe('<div class="nope-enter nope-enter-active">foo</div>')397 }).thenWaitFor(nextFrame).then(() => {398 expect(vm.$el.innerHTML).toMatch(/<div( class="")?>foo<\/div>/)399 }).then(done)400 })401 it('enterCancelled', done => {402 const spy = jasmine.createSpy('enterCancelled')403 const vm = new Vue({404 template: `405 <div>406 <transition name="test" @enter-cancelled="enterCancelled">407 <div v-if="ok" class="test">foo</div>408 </transition>409 </div>410 `,411 data: { ok: false },412 methods: {413 enterCancelled: spy414 }415 }).$mount(el)416 expect(vm.$el.innerHTML).toBe('<!---->')417 vm.ok = true418 waitForUpdate(() => {419 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')420 }).thenWaitFor(duration / 2).then(() => {421 vm.ok = false422 }).then(() => {423 expect(spy).toHaveBeenCalled()424 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')425 }).thenWaitFor(nextFrame).then(() => {426 expect(vm.$el.children[0].className).toBe('test test-leave-active')427 }).thenWaitFor(duration + 10).then(() => {428 expect(vm.$el.children.length).toBe(0)429 }).then(done)430 })431 it('should remove stale leaving elements', done => {432 const spy = jasmine.createSpy('afterLeave')433 const vm = new Vue({434 template: `435 <div>436 <transition name="test" @after-leave="afterLeave">437 <div v-if="ok" class="test">foo</div>438 </transition>439 </div>440 `,441 data: { ok: true },442 methods: {443 afterLeave: spy444 }445 }).$mount(el)446 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')447 vm.ok = false448 waitForUpdate(() => {449 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')450 }).thenWaitFor(duration / 2).then(() => {451 vm.ok = true452 }).then(() => {453 expect(spy).toHaveBeenCalled()454 expect(vm.$el.children.length).toBe(1) // should have removed leaving element455 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')456 }).thenWaitFor(nextFrame).then(() => {457 expect(vm.$el.children[0].className).toBe('test test-enter-active')458 }).thenWaitFor(duration + 10).then(() => {459 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')460 }).then(done)461 })462 it('transition with v-show', done => {463 const vm = new Vue({464 template: `465 <div>466 <transition name="test">467 <div v-show="ok" class="test">foo</div>468 </transition>469 </div>470 `,471 data: { ok: true }472 }).$mount(el)473 // should not apply transition on initial render by default474 expect(vm.$el.textContent).toBe('foo')475 expect(vm.$el.children[0].style.display).toBe('')476 expect(vm.$el.children[0].className).toBe('test')477 vm.ok = false478 waitForUpdate(() => {479 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')480 }).thenWaitFor(nextFrame).then(() => {481 expect(vm.$el.children[0].className).toBe('test test-leave-active')482 }).thenWaitFor(duration + 10).then(() => {483 expect(vm.$el.children[0].style.display).toBe('none')484 vm.ok = true485 }).then(() => {486 expect(vm.$el.children[0].style.display).toBe('')487 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')488 }).thenWaitFor(nextFrame).then(() => {489 expect(vm.$el.children[0].className).toBe('test test-enter-active')490 }).thenWaitFor(duration + 10).then(() => {491 expect(vm.$el.children[0].className).toBe('test')492 }).then(done)493 })494 it('transition with v-show, inside child component', done => {495 const vm = new Vue({496 template: `497 <div>498 <test v-show="ok"></test>499 </div>500 `,501 data: { ok: true },502 components: {503 test: {504 template: `<transition name="test"><div class="test">foo</div></transition>`505 }506 }507 }).$mount(el)508 // should not apply transition on initial render by default509 expect(vm.$el.textContent).toBe('foo')510 expect(vm.$el.children[0].style.display).toBe('')511 vm.ok = false512 waitForUpdate(() => {513 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')514 }).thenWaitFor(nextFrame).then(() => {515 expect(vm.$el.children[0].className).toBe('test test-leave-active')516 }).thenWaitFor(duration + 10).then(() => {517 expect(vm.$el.children[0].style.display).toBe('none')518 vm.ok = true519 }).then(() => {520 expect(vm.$el.children[0].style.display).toBe('')521 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')522 }).thenWaitFor(nextFrame).then(() => {523 expect(vm.$el.children[0].className).toBe('test test-enter-active')524 }).thenWaitFor(duration + 10).then(() => {525 expect(vm.$el.children[0].className).toBe('test')526 }).then(done)527 })528 it('leaveCancelled (v-show only)', done => {529 const spy = jasmine.createSpy('leaveCancelled')530 const vm = new Vue({531 template: `532 <div>533 <transition name="test" @leave-cancelled="leaveCancelled">534 <div v-show="ok" class="test">foo</div>535 </transition>536 </div>537 `,538 data: { ok: true },539 methods: {540 leaveCancelled: spy541 }542 }).$mount(el)543 expect(vm.$el.children[0].style.display).toBe('')544 vm.ok = false545 waitForUpdate(() => {546 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')547 }).thenWaitFor(nextFrame).then(() => {548 expect(vm.$el.children[0].className).toBe('test test-leave-active')549 }).thenWaitFor(10).then(() => {550 vm.ok = true551 }).then(() => {552 expect(spy).toHaveBeenCalled()553 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')554 }).thenWaitFor(nextFrame).then(() => {555 expect(vm.$el.children[0].className).toBe('test test-enter-active')556 }).thenWaitFor(duration + 10).then(() => {557 expect(vm.$el.children[0].style.display).toBe('')558 }).then(done)559 })560 it('animations', done => {561 const vm = new Vue({562 template: `563 <div>564 <transition name="test-anim">565 <div v-if="ok">foo</div>566 </transition>567 </div>568 `,569 data: { ok: true }570 }).$mount(el)571 // should not apply transition on initial render by default572 expect(vm.$el.innerHTML).toBe('<div>foo</div>')573 vm.ok = false574 waitForUpdate(() => {575 expect(vm.$el.children[0].className).toBe('test-anim-leave test-anim-leave-active')576 }).thenWaitFor(nextFrame).then(() => {577 expect(vm.$el.children[0].className).toBe('test-anim-leave-active')578 }).thenWaitFor(duration + 10).then(() => {579 expect(vm.$el.children.length).toBe(0)580 vm.ok = true581 }).then(() => {582 expect(vm.$el.children[0].className).toBe('test-anim-enter test-anim-enter-active')583 }).thenWaitFor(nextFrame).then(() => {584 expect(vm.$el.children[0].className).toBe('test-anim-enter-active')585 }).thenWaitFor(duration + 10).then(() => {586 expect(vm.$el.children[0].className).toBe('')587 }).then(done)588 })589 it('explicit transition type', done => {590 const vm = new Vue({591 template: `592 <div>593 <transition name="test-anim-long" type="animation">594 <div v-if="ok" class="test">foo</div>595 </transition>596 </div>597 `,598 data: { ok: true }599 }).$mount(el)600 // should not apply transition on initial render by default601 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')602 vm.ok = false603 waitForUpdate(() => {604 expect(vm.$el.children[0].className).toBe('test test-anim-long-leave test-anim-long-leave-active')605 }).thenWaitFor(nextFrame).then(() => {606 expect(vm.$el.children[0].className).toBe('test test-anim-long-leave-active')607 }).thenWaitFor(duration + 5).then(() => {608 // should not end early due to transition presence609 expect(vm.$el.children[0].className).toBe('test test-anim-long-leave-active')610 }).thenWaitFor(duration + 5).then(() => {611 expect(vm.$el.children.length).toBe(0)612 vm.ok = true613 }).then(() => {614 expect(vm.$el.children[0].className).toBe('test test-anim-long-enter test-anim-long-enter-active')615 }).thenWaitFor(nextFrame).then(() => {616 expect(vm.$el.children[0].className).toBe('test test-anim-long-enter-active')617 }).thenWaitFor(duration + 5).then(() => {618 expect(vm.$el.children[0].className).toBe('test test-anim-long-enter-active')619 }).thenWaitFor(duration + 5).then(() => {620 expect(vm.$el.children[0].className).toBe('test')621 }).then(done)622 })623 it('transition on appear', done => {624 const vm = new Vue({625 template: `626 <div>627 <transition name="test"628 appear629 appear-class="test-appear"630 appear-active-class="test-appear-active">631 <div v-if="ok" class="test">foo</div>632 </transition>633 </div>634 `,635 data: { ok: true }636 }).$mount(el)637 waitForUpdate(() => {638 expect(vm.$el.children[0].className).toBe('test test-appear test-appear-active')639 }).thenWaitFor(nextFrame).then(() => {640 expect(vm.$el.children[0].className).toBe('test test-appear-active')641 }).thenWaitFor(duration + 10).then(() => {642 expect(vm.$el.children[0].className).toBe('test')643 }).then(done)644 })645 it('transition on appear with v-show', done => {646 const vm = new Vue({647 template: `648 <div>649 <transition name="test" appear>650 <div v-show="ok" class="test">foo</div>651 </transition>652 </div>653 `,654 data: { ok: true }655 }).$mount(el)656 waitForUpdate(() => {657 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')658 }).thenWaitFor(nextFrame).then(() => {659 expect(vm.$el.children[0].className).toBe('test test-enter-active')660 }).thenWaitFor(duration + 10).then(() => {661 expect(vm.$el.children[0].className).toBe('test')662 }).then(done)663 })664 it('transition on SVG elements', done => {665 const vm = new Vue({666 template: `667 <svg>668 <transition>669 <circle cx="0" cy="0" r="10" v-if="ok" class="test"></circle>670 </transition>671 </svg>672 `,673 data: { ok: true }674 }).$mount(el)675 // should not apply transition on initial render by default676 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test')677 vm.ok = false678 waitForUpdate(() => {679 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave v-leave-active')680 }).thenWaitFor(nextFrame).then(() => {681 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave-active')682 }).thenWaitFor(duration + 10).then(() => {683 expect(vm.$el.childNodes.length).toBe(1)684 expect(vm.$el.childNodes[0].nodeType).toBe(8) // should be an empty comment node685 expect(vm.$el.childNodes[0].textContent).toBe('')686 vm.ok = true687 }).then(() => {688 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter v-enter-active')689 }).thenWaitFor(nextFrame).then(() => {690 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter-active')691 }).thenWaitFor(duration + 10).then(() => {692 expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test')693 }).then(done)694 })695 it('transition on child components', done => {696 const vm = new Vue({697 template: `698 <div>699 <transition>700 <test v-if="ok" class="test"></test>701 </transition>702 </div>703 `,704 data: { ok: true },705 components: {706 test: {707 template: `708 <transition name="test">709 <div>foo</div>710 </transition>711 ` // test transition override from parent712 }713 }714 }).$mount(el)715 // should not apply transition on initial render by default716 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')717 vm.ok = false718 waitForUpdate(() => {719 expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')720 }).thenWaitFor(nextFrame).then(() => {721 expect(vm.$el.children[0].className).toBe('test v-leave-active')722 }).thenWaitFor(duration + 10).then(() => {723 expect(vm.$el.children.length).toBe(0)724 vm.ok = true725 }).then(() => {726 expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')727 }).thenWaitFor(nextFrame).then(() => {728 expect(vm.$el.children[0].className).toBe('test v-enter-active')729 }).thenWaitFor(duration + 10).then(() => {730 expect(vm.$el.children[0].className).toBe('test')731 }).then(done)732 })733 it('transition inside child component', done => {734 const vm = new Vue({735 template: `736 <div>737 <test v-if="ok" class="test"></test>738 </div>739 `,740 data: { ok: true },741 components: {742 test: {743 template: `744 <transition>745 <div>foo</div>746 </transition>747 `748 }749 }750 }).$mount(el)751 // should not apply transition on initial render by default752 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')753 vm.ok = false754 waitForUpdate(() => {755 expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')756 }).thenWaitFor(nextFrame).then(() => {757 expect(vm.$el.children[0].className).toBe('test v-leave-active')758 }).thenWaitFor(duration + 10).then(() => {759 expect(vm.$el.children.length).toBe(0)760 vm.ok = true761 }).then(() => {762 expect(vm.$el.children[0].className).toBe('test v-enter v-enter-active')763 }).thenWaitFor(nextFrame).then(() => {764 expect(vm.$el.children[0].className).toBe('test v-enter-active')765 }).thenWaitFor(duration + 10).then(() => {766 expect(vm.$el.children[0].className).toBe('test')767 }).then(done)768 })769 it('custom transition higher-order component', done => {770 const vm = new Vue({771 template: '<div><my-transition><div v-if="ok" class="test">foo</div></my-transition></div>',772 data: { ok: true },773 components: {774 'my-transition': {775 functional: true,776 render (h, { data, children }) {777 (data.props || (data.props = {})).name = 'test'778 return h('transition', data, children)779 }780 }781 }782 }).$mount(el)783 // should not apply transition on initial render by default784 expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')785 vm.ok = false786 waitForUpdate(() => {787 expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')788 }).thenWaitFor(nextFrame).then(() => {789 expect(vm.$el.children[0].className).toBe('test test-leave-active')790 }).thenWaitFor(duration + 10).then(() => {791 expect(vm.$el.children.length).toBe(0)792 vm.ok = true793 }).then(() => {794 expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')795 }).thenWaitFor(nextFrame).then(() => {796 expect(vm.$el.children[0].className).toBe('test test-enter-active')797 }).thenWaitFor(duration + 10).then(() => {798 expect(vm.$el.children[0].className).toBe('test')799 }).then(done)800 })801 })...

Full Screen

Full Screen

mod_book.spec.js

Source:mod_book.spec.js Github

copy

Full Screen

...12// See the License for the specific language governing permissions and13// limitations under the License.14describe('User can manage course book', function() {15 it('Click All sections course book tabs', function (done) {16 return MM.loginAsStudent().then(function () {17 return MM.clickOnInSideMenu('My courses');18 }).then(function () {19 return MM.clickOn('Psychology in Cinema');20 }).then(function () {21 return MM.clickOn('All sections');22 }).then(function () {23 return MM.clickOn('Useful links');24 }).then(function () {25 return MM.goBack();26 }).then(function () {27 return MM.clickOn('Video resources');28 }).then(function () {29 return MM.goBack();30 }).then(function() {31 done();32 });33 });34 it('Click Background information course book tabs', function (done) {35 return MM.loginAsStudent().then(function () {36 return MM.clickOnInSideMenu('My courses');37 }).then(function () {38 return MM.clickOn('Psychology in Cinema');39 }).then(function () {40 return MM.clickOn('Background information');41 }).then(function () {42 return MM.clickOn('Useful links');43 }).then(function () {44 return MM.goBack();45 }).then(function () {46 return MM.clickOn('Video resources');47 }).then(function () {48 return MM.goBack();49 }).then(function() {50 done();51 });52 });53 it('Can go all the useful links press next and previous icon', function (done) {54 return MM.loginAsStudent().then(function () {55 return MM.clickOnInSideMenu('My courses');56 }).then(function () {57 return MM.clickOn('Psychology in Cinema');58 }).then(function () {59 return MM.clickOn('Background information');60 }).then(function () {61 return MM.clickOn('Useful links');62 }).then(function() {63 expect(MM.getView().getText()).toMatch('1 A beautiful Mind');64 }).then(function () {65 return $('[ng-click="action(next)"]').click();66 }).then(function() {67 expect(MM.getView().getText()).toMatch('2 Fight Club');68 }).then(function () {69 return $('[ng-click="action(next)"]').click();70 }).then(function() {71 expect(MM.getView().getText()).toMatch('3 Spider');72 }).then(function() {73 return $('[ng-click="action(previous)"]').click();74 }).then(function() {75 return $('[ng-click="action(previous)"]').click();76 }).then(function() {77 expect(MM.getView().getText()).toMatch('1 A beautiful Mind');78 }).then(function() {79 done();80 });81 });82 it('Click secondary button in useful links', function (done) {83 return MM.loginAsStudent().then(function () {84 return MM.clickOnInSideMenu('My courses');85 }).then(function () {86 return MM.clickOn('Psychology in Cinema');87 }).then(function () {88 return MM.clickOn('Background information');89 }).then(function () {90 return MM.clickOn('Useful links');91 }).then(function () {92 return $('[ng-href="http://school.demo.moodle.net/mod/book/view.php?id=707"]').click();93 }).then(function() {94 expect(MM.getView().getText()).toMatch('1 A beautiful Mind');95 }).then(function () {96 done();97 });98 });99 it('Click secondary menu button in useful links', function (done) {100 return MM.loginAsStudent().then(function () {101 return MM.clickOnInSideMenu('My courses');102 }).then(function () {103 return MM.clickOn('Psychology in Cinema');104 }).then(function () {105 return MM.clickOn('Background information');106 }).then(function () {107 return MM.clickOn('Useful links');108 }).then(function () {109 return $('[ng-click="popover.show($event)"]').click();110 }).then(function() {111 return element(by.xpath('/html/body/div[4]/div/ion-popover-view/ion-content/div[1]/nav/ul/li[3]/a')).click();112 expect(MM.getView().getText()).toMatch('Spider');113 }).then(function () {114 done();115 });116 });117 it('Can go all the Video resources press next and previous icon', function (done) {118 return MM.loginAsStudent().then(function () {119 return MM.clickOnInSideMenu('My courses');120 }).then(function () {121 return MM.clickOn('Psychology in Cinema');122 }).then(function () {123 return MM.clickOn('Background information');124 }).then(function () {125 return MM.clickOn('Video resources');126 }).then(function() {127 expect(MM.getView().getText()).toMatch('1 Trailer: A beautiful mind');128 }).then(function () {129 return $('[ng-click="action(next)"]').click();130 }).then(function() {131 expect(MM.getView().getText()).toMatch('2 Trailer: Fight club');132 }).then(function () {133 return $('[ng-click="action(next)"]').click();134 }).then(function() {135 expect(MM.getView().getText()).toMatch('3 Trailer: Spider');136 }).then(function() {137 return $('[ng-click="action(previous)"]').click();138 }).then(function() {139 return $('[ng-click="action(previous)"]').click();140 }).then(function() {141 expect(MM.getView().getText()).toMatch('1 Trailer: A beautiful mind');142 }).then(function() {143 done();144 });145 });146 it('Click secondary button in Video resources', function (done) {147 return MM.loginAsStudent().then(function () {148 return MM.clickOnInSideMenu('My courses');149 }).then(function () {150 return MM.clickOn('Psychology in Cinema');151 }).then(function () {152 return MM.clickOn('Background information');153 }).then(function () {154 return MM.clickOn('Video resources');155 }).then(function () {156 return $('[ng-href="http://school.demo.moodle.net/mod/book/view.php?id=708"]').click();157 }).then(function() {158 expect(MM.getView().getText()).toMatch('1 Trailer: A beautiful mind');159 }).then(function () {160 done();161 });162 });163 it('Click secondary menu button in Video resources', function (done) {164 return MM.loginAsStudent().then(function () {165 return MM.clickOnInSideMenu('My courses');166 }).then(function () {167 return MM.clickOn('Psychology in Cinema');168 }).then(function () {169 return MM.clickOn('Background information');170 }).then(function () {171 return MM.clickOn('Video resources');172 }).then(function () {173 return $('[ng-click="popover.show($event)"]').click();174 }).then(function() {175 return element(by.xpath('/html/body/div[4]/div/ion-popover-view/ion-content/div[1]/nav/ul/li[3]/a')).click();176 expect(MM.getView().getText()).toMatch('3 Trailer: Spider');177 }).then(function () {178 done();179 });180 });...

Full Screen

Full Screen

mod_choice.spec.js

Source:mod_choice.spec.js Github

copy

Full Screen

...12// See the License for the specific language governing permissions and13// limitations under the License.14describe('User can manage course choice', function() {15 it('Click All sections course choice tabs', function (done) {16 return MM.loginAsStudent().then(function () {17 return MM.clickOnInSideMenu('My courses');18 }).then(function () {19 return MM.clickOn('Psychology in Cinema');20 }).then(function () {21 return MM.clickOn('All sections');22 }).then(function () {23 return MM.clickOn('Prior Knowledge assessment');24 }).then(function() {25 expect(MM.getView().getText()).toMatch('State your prior knowledge here:');26 }).then(function () {27 return MM.goBack();28 }).then(function () {29 return MM.clickOn("Let's make a date!");30 }).then(function () {31 expect(MM.getView().getText()).toMatch('Please choose the best day and time for our next evening session. You can choose more than one if');32 }).then(function () {33 return MM.goBack();34 }).then(function() {35 done();36 });37 });38 it('Click Course welcome course choice tabs', function (done) {39 return MM.loginAsStudent().then(function () {40 return MM.clickOnInSideMenu('My courses');41 }).then(function () {42 return MM.clickOn('Psychology in Cinema');43 }).then(function () {44 return MM.clickOn('Course welcome');45 }).then(function () {46 return MM.clickOn('Prior Knowledge assessment');47 }).then(function() {48 expect(MM.getView().getText()).toMatch('State your prior knowledge here:');49 }).then(function () {50 return MM.goBack();51 }).then(function () {52 return MM.clickOn("Let's make a date!");53 }).then(function () {54 expect(MM.getView().getText()).toMatch('Please choose the best day and time for our next evening session. You can choose more than one if');55 }).then(function () {56 return MM.goBack();57 }).then(function() {58 done();59 });60 });61 it('Click Group Projects and Individual tasks course choice tabs', function (done) {62 return MM.loginAsStudent().then(function () {63 return MM.clickOnInSideMenu('My courses');64 }).then(function () {65 return MM.clickOn('Psychology in Cinema');66 }).then(function () {67 return MM.clickOn('Group Projects and Individual tasks');68 }).then(function () {69 return MM.clickOn('Select your focus film');70 }).then(function() {71 expect(MM.getView().getText()).toMatch('Select here the film you wish to do your in depth group study on.');72 }).then(function () {73 return MM.goBack();74 }).then(function() {75 done();76 });77 });78 it('User can manage Prior Knowledge assessment choices', function (done) {79 return MM.loginAsStudent().then(function () {80 return MM.clickOnInSideMenu('My courses');81 }).then(function () {82 return MM.clickOn('Psychology in Cinema');83 }).then(function () {84 return MM.clickOn('Course welcome');85 }).then(function () {86 return MM.clickOn('Prior Knowledge assessment');87 }).then(function() {88 return MM.clickOn('State your prior knowledge here:');89 }).then(function () {90 expect(MM.getView().getText()).toMatch('State your prior knowledge here:');91 }).then(function () {92 return MM.goBack();93 }).then(function() {94 return MM.clickOn('I have studied this ');95 }).then(function() {96 return MM.clickOn('I have a good working knowledge ');97 }).then(function() {98 return MM.clickOn('I have some knowledge');99 }).then(function() {100 return MM.clickOn('I am a complete beginner');101 }).then(function () {102 return MM.goBack();103 }).then(function() {104 done();105 });106 });107 it("User can manage Let's make a date! assessment choices", function (done) {108 return MM.loginAsStudent().then(function () {109 return MM.clickOnInSideMenu('My courses');110 }).then(function () {111 return MM.clickOn('Psychology in Cinema');112 }).then(function () {113 return MM.clickOn('Course welcome');114 }).then(function () {115 return MM.clickOn("Let's make a date!");116 }).then(function() {117 return MM.clickOn('Please choose the best day and time for our next evening session.');118 }).then(function () {119 expect(MM.getView().getText()).toMatch('Please choose the best day and time for our next evening session.');120 }).then(function () {121 return MM.goBack();122 }).then(function() {123 return MM.clickOn('Friday at 18.00');124 }).then(function() {125 return MM.clickOn('Monday at 17.30');126 }).then(function() {127 return MM.clickOn('Wednesday at 19.00');128 }).then(function() {129 return $('[ng-click="save()"]').click();130 }).then(function() {131 return MM.clickOn('Cancel');132 }).then(function () {133 return MM.goBack();134 }).then(function() {135 done();136 });137 });138 it("User can manage Group Projects and Individual tasks assessment choices", function (done) {139 return MM.loginAsStudent().then(function () {140 return MM.clickOnInSideMenu('My courses');141 }).then(function () {142 return MM.clickOn('Psychology in Cinema');143 }).then(function () {144 return MM.clickOn("Group Projects and Individual tasks");145 }).then(function() {146 return MM.clickOn('Select your focus film');147 }).then(function() {148 return MM.clickOn('Select here the film you wish to do your in depth group study on.');149 }).then(function () {150 expect(MM.getView().getText()).toMatch('Select here the film you wish to do your in depth group study on.');151 }).then(function () {152 return MM.goBack();153 }).then(function () {154 return MM.goBack();155 }).then(function() {156 done();157 });158 });159 it('Click secondary button', function (done) {160 return MM.loginAsStudent().then(function () {161 return MM.clickOnInSideMenu('My courses');162 }).then(function () {163 return MM.clickOn('Psychology in Cinema');164 }).then(function () {165 return MM.clickOn("Group Projects and Individual tasks");166 }).then(function() {167 return MM.clickOn('Select your focus film');168 }).then(function () {169 return $('.secondary-buttons').click();170 }).then(function() {171 return MM.goBack();172 }).then(function () {173 done();174 });175 });...

Full Screen

Full Screen

mod_forum.spec.js

Source:mod_forum.spec.js Github

copy

Full Screen

...12// See the License for the specific language governing permissions and13// limitations under the License.14describe('User can manage course forum', function() {15 it('Click All sections course forum tabs', function (done) {16 return MM.loginAsStudent().then(function () {17 return MM.clickOnInSideMenu('My courses');18 }).then(function () {19 return MM.clickOn('Psychology in Cinema');20 }).then(function () {21 return MM.clickOn('All sections');22 }).then(function () {23 return MM.clickOn('Announcements from your tutor');24 }).then(function () {25 return MM.goBack();26 }).then(function() {27 done();28 });29 });30 it('View course forum windows', function (done) {31 return MM.loginAsStudent().then(function () {32 return MM.clickOnInSideMenu('My courses')33 }).then(function () {34 return MM.clickOn('Psychology in Cinema');35 }).then(function () {36 return MM.clickOn('Course welcome');37 }).then(function () {38 return MM.clickOn('Announcements from your tutor');39 }).then(function() {40 expect(MM.getView().getText()).toMatch('General news and announcements');41 expect(MM.getView().getText()).toMatch('Group Project');42 }).then(function () {43 return MM.clickOn('General news and announcements');44 }).then(function () {45 expect(MM.getView().getText()).toMatch('General news and announcements');46 }).then(function () {47 return MM.goBack()48 }).then(function() {49 done();50 });51 });52 it('View course Forum grade test windows', function (done) {53 return MM.loginAsStudent().then(function () {54 return MM.clickOnInSideMenu('My courses')55 }).then(function () {56 return MM.clickOn('Psychology in Cinema');57 }).then(function () {58 return MM.clickOn('Course welcome');59 }).then(function () {60 return MM.clickOn('Forum grade test');61 }).then(function() {62 expect(MM.getView().getText()).toMatch('Add a new discussion topic');63 expect(MM.getView().getText()).toMatch('Forum grade test');64 }).then(function () {65 return MM.goBack()66 }).then(function() {67 done();68 });69 });70 it('Add a new discussion topic', function (done) {71 return MM.loginAsStudent().then(function () {72 return MM.clickOnInSideMenu('My courses')73 }).then(function () {74 return MM.clickOn('Psychology in Cinema');75 }).then(function () {76 return MM.clickOn('Course welcome');77 }).then(function () {78 return MM.clickOn('Forum grade test');79 }).then(function () {80 return MM.clickOn('Add a new discussion topic');81 }).then(function() {82 return $('[ng-model="newdiscussion.subject"]').sendKeys('Test Discussion Subject');83 }).then(function() {84 return $('[ng-model="newdiscussion.message"]').sendKeys('Test Discussion Message');85 }).then(function() {86 return $('[ng-click="add()"]').click();87 }).then(function () {88 return MM.goBack()89 }).then(function() {90 done();91 });92 });93 it('Add a new Course discussion', function (done) {94 return MM.loginAsStudent().then(function () {95 return MM.clickOnInSideMenu('My courses')96 }).then(function () {97 return MM.clickOn('Psychology in Cinema');98 }).then(function () {99 return MM.clickOn('Analysis');100 }).then(function () {101 return MM.clickOn('Course discussion');102 }).then(function () {103 return MM.clickOn('Add a new discussion topic');104 }).then(function() {105 return $('[ng-model="newdiscussion.subject"]').sendKeys('Test Subject');106 }).then(function() {107 return $('[ng-model="newdiscussion.message"]').sendKeys('Test Message');108 }).then(function() {109 return $('[ng-click="add()"]').click();110 }).then(function () {111 return MM.goBack()112 }).then(function() {113 done();114 });115 });116 it('Discussions about your group projects', function (done) {117 return MM.loginAsStudent().then(function () {118 return MM.clickOnInSideMenu('My courses')119 }).then(function () {120 return MM.clickOn('Psychology in Cinema');121 }).then(function () {122 return MM.clickOn('Group Projects and Individual tasks');123 }).then(function () {124 return MM.clickOn('Discussions about your group projects');125 }).then(function () {126 return MM.clickOn('Add a new discussion topic');127 }).then(function() {128 return $('[ng-model="newdiscussion.subject"]').sendKeys('Test Group Projects Subject');129 }).then(function() {130 return $('[ng-model="newdiscussion.message"]').sendKeys('Test Group Projects Message');131 }).then(function() {132 return $('[ng-click="add()"]').click();133 }).then(function () {134 return MM.goBack()135 }).then(function() {136 done();137 });138 });139 it('Click secondary button', function (done) {140 return MM.loginAsStudent().then(function () {141 return MM.clickOnInSideMenu('My courses')142 }).then(function () {143 return MM.clickOn('Psychology in Cinema');144 }).then(function () {145 return MM.clickOn('Course welcome');146 }).then(function () {147 return MM.clickOn('Announcements from your tutor');148 }).then(function () {149 return $('.secondary-buttons').click();150 }).then(function() {151 return MM.goBack();152 }).then(function () {153 done();154 });155 });...

Full Screen

Full Screen

index.spec.js

Source:index.spec.js Github

copy

Full Screen

1require('../index');2const K = require('knex')({ client: 'mssql' });3describe('K.case', () => {4 it('should have the case specific methods', () => {5 // when6 expect(K.client.when).toBeInstanceOf(Function);7 expect(K.queryBuilder().when).toBeInstanceOf(Function);8 // orWhen9 expect(K.client.orWhen).toBeInstanceOf(Function);10 expect(K.client.queryBuilder().orWhen).toBeInstanceOf(Function);11 // andWhen12 expect(K.client.andWhen).toBeInstanceOf(Function);13 expect(K.client.queryBuilder().andWhen).toBeInstanceOf(Function);14 // thenElse15 expect(K.client.thenElse).toBeInstanceOf(Function);16 expect(K.client.queryBuilder().thenElse).toBeInstanceOf(Function);17 // else18 expect(K.client.else).toBeInstanceOf(Function);19 expect(K.client.queryBuilder().else).toBeInstanceOf(Function);20 });21 it('should be able to take a single when clause', () => {22 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;23 const result = K.queryBuilder()24 .when('column', '=', 1)25 .thenElse(1, 0)26 .toQuery();27 expect(result).toBe(expected);28 });29 it('should be able to take a multiple when clauses', () => {30 const expected = `(CASE WHEN column=1 THEN 1 WHEN column=2 THEN 2 ELSE 0 END)`;31 const result = K.queryBuilder()32 .when('column', '=', 1)33 .thenElse(1)34 .when('column', '=', 2)35 .thenElse(2, 0)36 .toQuery();37 expect(result).toBe(expected);38 });39 it('should be able to take a multiple when `or` and `and` clauses', () => {40 const expected = `(CASE WHEN column=1 OR column_two=3 AND column_three=2 THEN 1 WHEN column=2 THEN 2 ELSE 0 END)`;41 const result = K.queryBuilder()42 .when('column', '=', 1)43 .orWhen('column_two', '=', 3)44 .andWhen('column_three', '=', 2)45 .thenElse(1)46 .when('column', '=', 2)47 .thenElse(2, 0)48 .toQuery();49 expect(result).toBe(expected);50 });51 it('should be able to take a multiple when `or` and `and` clauses, also alias', () => {52 const expected = `(CASE WHEN column=1 OR column_two=3 AND column_three=2 THEN 1 WHEN column=2 THEN 2 ELSE 0 END) AS COL`;53 const result = K.queryBuilder()54 .when('column', '=', 1)55 .orWhen('column_two', '=', 3)56 .andWhen('column_three', '=', 2)57 .thenElse(1)58 .when('column', '=', 2)59 .thenElse(2, 0)60 .as('COL')61 .toQuery();62 expect(result).toBe(expected);63 });64 it('should be able to nest kase statements', () => {65 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 0 END)`;66 const result = K.queryBuilder()67 .when('column', '=', 1)68 .orWhen('column_two', '=', 3)69 .thenElse(70 K.queryBuilder()71 .when('column', '=', 2)72 .thenElse(2, 5)73 )74 .else(0)75 .toQuery();76 expect(result).toBe(expected);77 });78 it('should be able to nest kase statements, with alias', () => {79 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 0 END) AS COL`;80 const result = K.queryBuilder()81 .when('column', '=', 1)82 .orWhen('column_two', '=', 3)83 .thenElse(84 K.queryBuilder()85 .when('column', '=', 2)86 .thenElse(2, 5)87 )88 .else(0)89 .as('COL')90 .toQuery();91 expect(result).toBe(expected);92 });93 describe('value formatting', () => {94 describe('when value', () => {95 it('should be able to handle empty string as a value', () => {96 const expected = `(CASE WHEN column='' THEN 1 ELSE 0 END)`;97 const result = K.queryBuilder()98 .when('column', '=', `''`)99 .thenElse(1, 0)100 .toQuery();101 expect(result).toEqual(expected);102 });103 it('should be able to handle string as a value', () => {104 const expected = `(CASE WHEN column='hello' THEN 1 ELSE 0 END)`;105 const result = K.queryBuilder()106 .when('column', '=', `'hello'`)107 .thenElse(1, 0)108 .toQuery();109 expect(result).toEqual(expected);110 });111 it('should be able to handle numbers of a value', () => {112 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;113 const result = K.queryBuilder()114 .when('column', '=', 1)115 .thenElse(1, 0)116 .toQuery();117 expect(result).toEqual(expected);118 });119 });120 describe('thenElse values', () => {121 it('should be able to handle string as a value', () => {122 const expected = `(CASE WHEN column='hello' THEN 1 ELSE 0 END)`;123 const result = K.queryBuilder()124 .when('column', '=', `'hello'`)125 .thenElse('1', '0')126 .toQuery();127 expect(result).toEqual(expected);128 });129 it('should be able to handle numbers of a value', () => {130 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;131 const result = K.queryBuilder()132 .when('column', '=', 1)133 .thenElse(1, 0)134 .toQuery();135 expect(result).toEqual(expected);136 });137 });138 describe('else values', () => {139 it('should be able to handle string as a value', () => {140 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 'wow' END)`;141 const result = K.queryBuilder()142 .when('column', '=', 1)143 .orWhen('column_two', '=', 3)144 .thenElse(145 K.queryBuilder()146 .when('column', '=', 2)147 .thenElse(2, 5)148 )149 .else(`'wow'`)150 .toQuery();151 expect(result).toBe(expected);152 });153 it('should be able to handle numbers of a value', () => {154 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 0 END)`;155 const result = K.queryBuilder()156 .when('column', '=', 1)157 .orWhen('column_two', '=', 3)158 .thenElse(159 K.queryBuilder()160 .when('column', '=', 2)161 .thenElse(2, 5)162 )163 .else(0)164 .toQuery();165 expect(result).toBe(expected);166 });167 });168 });...

Full Screen

Full Screen

mod_glossary.spec.js

Source:mod_glossary.spec.js Github

copy

Full Screen

...12// See the License for the specific language governing permissions and13// limitations under the License.14describe('User can manage course glossary', function() {15 it('Click All sections course glossary tabs', function (done) {16 return MM.loginAsStudent().then(function () {17 return MM.clickOnInSideMenu('My courses');18 }).then(function () {19 return MM.clickOn('Psychology in Cinema');20 }).then(function () {21 return MM.clickOn('All sections');22 }).then(function () {23 return MM.clickOn('Concepts and Characters');24 }).then(function () {25 return MM.goBack();26 }).then(function() {27 done();28 });29 });30 it('View course glossary windows', function (done) {31 return MM.loginAsStudent().then(function () {32 return MM.clickOnInSideMenu('My courses')33 }).then(function () {34 return MM.clickOn('Psychology in Cinema');35 }).then(function () {36 return MM.clickOn('Background information');37 }).then(function () {38 return MM.clickOn('Concepts and Characters');39 }).then(function() {40 expect(MM.getView().getText()).toMatch('A glossary of the key concepts and characters involved');41 expect(MM.getView().getText()).toMatch('Dissociative Identity Disorder');42 }).then(function () {43 return MM.clickOn('A glossary of the key concepts and characters involved');44 }).then(function () {45 expect(MM.getView().getText()).toMatch('A glossary of the key concepts and characters involved');46 }).then(function () {47 return MM.goBack()48 }).then(function() {49 done();50 });51 });52 it('Click course glossary tabs', function (done) {53 return MM.loginAsStudent().then(function () {54 return MM.clickOnInSideMenu('My courses')55 }).then(function () {56 return MM.clickOn('Psychology in Cinema');57 }).then(function () {58 return MM.clickOn('Background information');59 }).then(function () {60 return MM.clickOn('Concepts and Characters');61 }).then(function () {62 return MM.clickOn('Dissociative Identity Disorder');63 }).then(function () {64 return MM.goBack();65 }).then(function () {66 return MM.clickOn('John Nash');67 }).then(function () {68 return MM.goBack();69 }).then(function () {70 return MM.clickOn('Paranoid schizophrenia');71 }).then(function () {72 return MM.goBack();73 }).then(function () {74 return MM.clickOn('Robert');75 }).then(function () {76 return MM.goBack();77 }).then(function () {78 return MM.clickOn('Tyler Durden');79 }).then(function () {80 return MM.goBack();81 }).then(function () {82 return MM.goBack()83 }).then(function() {84 done();85 });86 });87 it('Search course glossary', function (done) {88 return MM.loginAsStudent().then(function () {89 return MM.clickOnInSideMenu('My courses')90 }).then(function () {91 return MM.clickOn('Psychology in Cinema');92 }).then(function () {93 return MM.clickOn('Background information');94 }).then(function () {95 return MM.clickOn('Concepts and Characters');96 }).then(function () {97 return $('[ng-click="pickMode($event)"]').click();98 }).then(function () {99 return MM.clickOn('Search');100 }).then(function () {101 return $('[ng-model="searchData.searchQuery"]').sendKeys('Tyler Durden');102 }).then(function () {103 return MM.clickOn('Search');104 }).then(function () {105 return MM.clickOn('Tyler Durden');106 }).then(function () {107 return MM.goBack()108 }).then(function() {109 done();110 });111 });112 it('Click secondary button', function (done) {113 return MM.loginAsStudent().then(function () {114 return MM.clickOnInSideMenu('My courses')115 }).then(function () {116 return MM.clickOn('Psychology in Cinema');117 }).then(function () {118 return MM.clickOn('Background information');119 }).then(function () {120 return MM.clickOn('Concepts and Characters');121 }).then(function () {122 return $('.secondary-buttons').click();123 }).then(function() {124 return MM.goBack();125 }).then(function () {126 done();127 });128 });...

Full Screen

Full Screen

mod_chat.spec.js

Source:mod_chat.spec.js Github

copy

Full Screen

...12// See the License for the specific language governing permissions and13// limitations under the License.14describe('User can manage course chat', function() {15 it('Click All sections course chat tabs', function (done) {16 return MM.loginAsStudent().then(function () {17 return MM.clickOnInSideMenu('My courses');18 }).then(function () {19 return MM.clickOn('Psychology in Cinema');20 }).then(function () {21 return MM.clickOn('All sections');22 }).then(function () {23 return MM.clickOn('Course chat');24 }).then(function () {25 return MM.goBack();26 }).then(function() {27 done();28 });29 });30 it('View course chat windows', function (done) {31 return MM.loginAsStudent().then(function () {32 return MM.clickOnInSideMenu('My courses');33 }).then(function () {34 return MM.clickOn('Psychology in Cinema');35 }).then(function () {36 return MM.clickOn('Course welcome');37 }).then(function () {38 return MM.clickOn('Course chat');39 }).then(function() {40 expect(MM.getView().getText()).toMatch('Heather and I will be available on this chat most lunchtimes');41 expect(MM.getView().getText()).toMatch('Click here to enter the chat now');42 }).then(function() {43 done();44 });45 });46 it('Click description tab', function (done) {47 return MM.loginAsStudent().then(function () {48 return MM.clickOnInSideMenu('My courses');49 }).then(function () {50 return MM.clickOn('Psychology in Cinema');51 }).then(function () {52 return MM.clickOn('Course welcome');53 }).then(function () {54 return MM.clickOn('Course chat');55 }).then(function () {56 return MM.clickOn('Heather and I will be available on this chat most lunchtimes');57 }).then(function () {58 expect(MM.getView().getText()).toMatch('Heather and I will be available on this chat most lunchtimes');59 }).then(function () {60 return MM.goBack();61 }).then(function () {62 done();63 });64 });65 it('Adding new chat message', function (done) {66 return MM.loginAsStudent().then(function () {67 return MM.clickOnInSideMenu('My courses');68 }).then(function () {69 return MM.clickOn('Psychology in Cinema');70 }).then(function () {71 return MM.clickOn('Course welcome');72 }).then(function () {73 return MM.clickOn('Course chat');74 }).then(function () {75 return MM.clickOn('Click here to enter the chat now');76 }).then(function () {77 return $('[ng-model="newMessage.text"]').sendKeys('Hi All..');78 }).then(function () {79 return element(by.xpath('/html/body/ion-nav-view/ion-side-menus/ion-side-menu-content/ion-nav-view/div/ion-footer-bar/form/div/button')).click();80 expect(MM.getView().getText()).toMatch('Hi All..');81 }).then(function () {82 return MM.goBack();83 }).then(function () {84 done();85 });86 });87 it('View chat users', function (done) {88 return MM.loginAsStudent().then(function () {89 return MM.clickOnInSideMenu('My courses');90 }).then(function () {91 return MM.clickOn('Psychology in Cinema');92 }).then(function () {93 return MM.clickOn('Course welcome');94 }).then(function () {95 return MM.clickOn('Course chat');96 }).then(function () {97 return MM.clickOn('Click here to enter the chat now');98 }).then(function () {99 return $('[ng-click="showChatUsers()"]').click();100 }).then(function () {101 return $('[ng-click="closeModal()"]').click();102 }).then(function () {103 return MM.goBack();104 }).then(function () {105 done();106 });107 });108 it('Click secondary button', function (done) {109 return MM.loginAsStudent().then(function () {110 return MM.clickOnInSideMenu('My courses');111 }).then(function () {112 return MM.clickOn('Psychology in Cinema');113 }).then(function () {114 return MM.clickOn('Course welcome');115 }).then(function () {116 return MM.clickOn('Course chat');117 }).then(function () {118 return $('.secondary-buttons').click();119 }).then(function() {120 return MM.goBack();121 }).then(function () {122 done();123 });124 });...

Full Screen

Full Screen

kase.spec.js

Source:kase.spec.js Github

copy

Full Screen

1const kase = require('../kase');2describe('.kase', () => {3 it('should be able to take a single when clause', () => {4 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;5 const result = kase()6 .when('column', '=', 1)7 .thenElse(1, 0);8 expect(result).toBe(expected);9 });10 it('should be able to take a multiple when clauses', () => {11 const expected = `(CASE WHEN column=1 THEN 1 WHEN column=2 THEN 2 ELSE 0 END)`;12 const result = kase()13 .when('column', '=', 1)14 .thenElse(1)15 .when('column', '=', 2)16 .thenElse(2, 0);17 expect(result).toBe(expected);18 });19 it('should be able to take a multiple when `or` and `and` clauses', () => {20 const expected = `(CASE WHEN column=1 OR column_two=3 AND column_three=2 THEN 1 WHEN column=2 THEN 2 ELSE 0 END)`;21 const result = kase()22 .when('column', '=', 1)23 .orWhen('column_two', '=', 3)24 .andWhen('column_three', '=', 2)25 .thenElse(1)26 .when('column', '=', 2)27 .thenElse(2, 0);28 expect(result).toBe(expected);29 });30 it('should be able to nest kase statements', () => {31 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 0 END)`;32 const result = kase()33 .when('column', '=', 1)34 .orWhen('column_two', '=', 3)35 .thenElse(36 kase()37 .when('column', '=', 2)38 .thenElse(2, 5)39 )40 .else(0);41 expect(result).toBe(expected);42 });43 describe('value formatting', () => {44 describe('when value', () => {45 it('should be able to handle empty string as a value', () => {46 const expected = `(CASE WHEN column='' THEN 1 ELSE 0 END)`;47 const result = kase()48 .when('column', '=', `''`)49 .thenElse(1, 0);50 expect(result).toEqual(expected);51 });52 it('should be able to handle string as a value', () => {53 const expected = `(CASE WHEN column='hello' THEN 1 ELSE 0 END)`;54 const result = kase()55 .when('column', '=', `'hello'`)56 .thenElse(1, 0);57 expect(result).toEqual(expected);58 });59 it('should be able to handle numbers of a value', () => {60 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;61 const result = kase()62 .when('column', '=', 1)63 .thenElse(1, 0);64 expect(result).toEqual(expected);65 });66 });67 describe('thenElse values', () => {68 it('should be able to handle string as a value', () => {69 const expected = `(CASE WHEN column='hello' THEN 1 ELSE 0 END)`;70 const result = kase()71 .when('column', '=', `'hello'`)72 .thenElse('1', '0');73 expect(result).toEqual(expected);74 });75 it('should be able to handle numbers of a value', () => {76 const expected = `(CASE WHEN column=1 THEN 1 ELSE 0 END)`;77 const result = kase()78 .when('column', '=', 1)79 .thenElse(1, 0);80 expect(result).toEqual(expected);81 });82 });83 describe('else values', () => {84 it('should be able to handle string as a value', () => {85 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 'wow' END)`;86 const result = kase()87 .when('column', '=', 1)88 .orWhen('column_two', '=', 3)89 .thenElse(90 kase()91 .when('column', '=', 2)92 .thenElse(2, 5)93 )94 .else(`'wow'`);95 expect(result).toBe(expected);96 });97 it('should be able to handle numbers of a value', () => {98 const expected = `(CASE WHEN column=1 OR column_two=3 THEN (CASE WHEN column=2 THEN 2 ELSE 5 END) ELSE 0 END)`;99 const result = kase()100 .when('column', '=', 1)101 .orWhen('column_two', '=', 3)102 .thenElse(103 kase()104 .when('column', '=', 2)105 .thenElse(2, 5)106 )107 .else(0);108 expect(result).toBe(expected);109 });110 });111 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const assert = require('assert');3fc.assert(4 fc.property(5 fc.integer(),6 fc.integer(),7 (a, b) => {8 return a + b === b + a;9 }10);11fc.assert(12 fc.property(13 fc.integer(),14 fc.integer(),15 (a, b) => {16 return a + b === b + a;17 }18 ).then((result) => {19 assert.ok(result.failed === 0);20 })21);22fc.assert(23 fc.property(24 fc.integer(),25 fc.integer(),26 async (a, b) => {27 return a + b === b + a;28 }29);30fc.assert(31 fc.property(32 fc.integer(),33 fc.integer(),34 async (a, b) => {35 return a + b === b + a;36 }37 ).then((result) => {38 assert.ok(result.failed === 0);39 })40);41fc.assert(42 fc.property(43 fc.integer(),44 fc.integer(),45 async (a, b) => {46 return a + b === b + a;47 }48 ).then((result) => {49 assert.ok(result.failed === 0);50 })51);52fc.assert(53 fc.property(54 fc.integer(),55 fc.integer(),56 async (a, b) => {57 return a + b === b + a;58 }59 ).then((result) => {60 assert.ok(result.failed === 0);61 })62);63fc.assert(64 fc.property(65 fc.integer(),66 fc.integer(),67 async (a, b) => {68 return a + b === b + a;69 }70 ).then((result) => {71 assert.ok(result.failed === 0);72 })73);74fc.assert(75 fc.property(76 fc.integer(),77 fc.integer(),78 async (a, b) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check')2const assert = require('assert')3fc.assert(4 fc.property(fc.integer(), fc.integer(), (a, b) => {5 })6const fc = require('fast-check')7const assert = require('assert')8fc.assert(9 fc.property(fc.integer(), fc.integer(), (a, b) => {10 })11const fc = require('fast-check')12const assert = require('assert')13fc.assert(14 fc.property(fc.integer(), fc.integer(), (a, b) => {15 })16const fc = require('fast-check')17const assert = require('assert')18fc.assert(19 fc.property(fc.integer(), fc.integer(), (a, b) => {20 })21const fc = require('fast-check')22const assert = require('assert')23fc.assert(24 fc.property(fc.integer(), fc.integer(), (a, b) => {25 })26const fc = require('fast-check')27const assert = require('assert')28fc.assert(29 fc.property(fc.integer(), fc.integer(), (a, b) => {30 })31const fc = require('fast-check')32const assert = require('assert')33fc.assert(34 fc.property(fc.integer(), fc.integer(), (a, b) => {35 })36const fc = require('fast-check')37const assert = require('assert')38fc.assert(39 fc.property(fc.integer(), fc.integer(), (a, b) => {40 })41const fc = require('fast-check')42const assert = require('assert')43fc.assert(44 fc.property(fc.integer(), fc.integer(), (a, b) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const add = (a, b) => a + b;3fc.assert(4 fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)5);6const fc = require('fast-check');7const add = (a, b) => a + b;8fc.assert(9 fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)10);11const fc = require('fast-check');12const add = (a, b) => a + b;13fc.assert(14 fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)15);16const fc = require('fast-check');17const add = (a, b) => a + b;18fc.assert(19 fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)20);21const fc = require('fast-check');22const add = (a, b) => a + b;23fc.assert(24 fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)25);

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require("fast-check");2const { add } = require("./add.js");3console.log(fc.check(fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)));4const fc = require("fast-check");5const { add } = require("./add.js");6console.log(fc.check(fc.property(fc.integer(), fc.integer(), (a, b) => add(a, b) === a + b)));

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { then } = require('fast-check');3const { then } = require('fast-check');4const fc = require('fast-check');5const { then } = require('fast-check');6const { then } = require('fast-check');7const fc = require('fast-check');8const { then } = require('fast-check');9const { then } = require('fast-check');10const fc = require('fast-check');11const { then } = require('fast-check');12const { then } = require('fast-check');13const fc = require('fast-check');14const { then } = require('fast-check');15const { then } = require('fast-check');16const fc = require('fast-check');17const { then } = require('fast-check');18const { then } = require('fast-check');19const fc = require('fast-check');20const { then } = require('fast-check');21const { then } = require('fast-check');22const fc = require('fast-check');23const { then } = require('fast-check');24const { then } = require('fast-check');25const fc = require('fast-check');26const { then } = require('fast-check');27const { then } = require('fast-check');28const fc = require('fast-check');29const { then } = require('fast-check');30const { then } = require('fast-check');31const fc = require('fast-check');32const { then } = require('fast-check');33const { then } = require('fast-check');34const fc = require('fast-check');35const { then } = require('fast-check');36const { then } = require('fast-check');37const fc = require('fast

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check')2const { then } = require('fast-check-monorepo')3const add = (a, b) => a + b4const addThenMultiply = (a, b, c) => add(a, b) * c5then(6 fc.integer(),7 fc.integer(),8 fc.integer(),9 (a, b, c) => {10 const actual = addThenMultiply(a, b, c)11 },12 { numRuns: 100 }13then(14 fc.integer(),15 fc.integer(),16 fc.integer(),17 (a, b, c) => {18 const actual = addThenMultiply(a, b, c)19 },20 { numRuns: 100 }21then(22 fc.integer(),23 fc.integer(),24 fc.integer(),25 (a, b, c) => {26 const actual = addThenMultiply(a, b, c)27 },28 { numRuns: 100 }29then(30 fc.integer(),31 fc.integer(),32 fc.integer(),33 (a, b, c) => {34 const actual = addThenMultiply(a, b, c)35 },36 { numRuns: 100 }37then(38 fc.integer(),39 fc.integer(),40 fc.integer(),41 (a, b, c) => {42 const actual = addThenMultiply(a, b, c)43 },44 { numRuns: 100 }45then(46 fc.integer(),47 fc.integer(),48 fc.integer(),49 (a, b, c) => {50 const actual = addThenMultiply(a, b, c)51 },52 { numRuns: 100 }53then(54 fc.integer(),55 fc.integer(),56 fc.integer(),57 (a, b, c) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const assert = require('assert');3const { add, mul } = require('./test1');4const { sub, div } = require('./test2');5fc.assert(6 fc.property(fc.integer(), fc.integer(), (a, b) => {7 assert.equal(add(a, b), a + b);8 })9);10fc.assert(11 fc.property(fc.integer(), fc.integer(), (a, b) => {12 assert.equal(mul(a, b), a * b);13 })14);15fc.assert(16 fc.property(fc.integer(), fc.integer(), (a, b) => {17 assert.equal(sub(a, b), a - b);18 })19);20fc.assert(21 fc.property(fc.integer(), fc.integer(), (a, b) => {22 assert.equal(div(a, b), a / b);23 })24);25fc.assert(26 fc.property(fc.integer(), fc.integer(), (a, b) => {27 assert.equal(add(mul(a, b), sub(a, b)), a * b + a - b);28 })29);30fc.assert(31 fc.property(fc.integer(), fc.integer(), (a, b) => {32 assert.equal(div(add(a, b), mul(a, b)), (a + b) / (a * b));33 })34);35fc.assert(36 fc.property(fc.integer(), fc.integer(), (a, b) => {37 assert.equal(sub(div(a, b), mul(a, b)), (a / b) - (a * b));38 })39);40fc.assert(41 fc.property(fc.integer(), fc.integer(), (a, b) => {42 assert.equal(mul(sub(a, b), div(a, b)), (a - b) * (a / b));43 })44);45fc.assert(46 fc.property(fc.integer(), fc.integer(), (a, b) => {47 assert.equal(add(mul(sub(a, b), div(a, b)), sub(div(a, b), mul(a, b))), (a - b) * (a / b) + (a / b) - (a *

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const {then, property} = require('fast-check');3const {add, multiply} = require('./test2');4const addThenMultiply = then(add, multiply);5property(addThenMultiply, addThenMultiply, (a, b) => {6 return a + b === addThenMultiply(a, b);7});8const add = (a, b) => a + b;9const multiply = (a, b) => a * b;10module.exports = {11};12const {add, multiply} = require('./test2');13const addThenMultiply = (a, b, c) => multiply(add(a, b), c);14module.exports = {15};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { check, property } = require("fast-check");2const generateRandomArray = () => {3 return check(4 property(5 .array(6 fc.integer({ min: 1, max: 100 }),7 .then((arr) => {8 return arr;9 }),10 (arr) => {11 .array(12 fc.integer({ min: 1, max: 100 }),13 .then((arr) => {14 return arr.sort();15 });16 }17 );18};19generateRandomArray();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful