Open janga1997 opened 7 years ago
@janga1997 Thanks for showing interest in Plone foundation for writing tests. But I will suggest you should come with some more better ideas than just writing tests as the GSOC project. Writing tests may include one part of the project.
@prakharjoshi i am not proposing writing tests as the project. I want to write tests as part of the proposal to get some PRs in. I am applying to a project which relates to patterns,.
Hi @janga1997!
All tests are in the mockup/tests
folder. The filename structure is pattern-[pattern name]-test.js
.
You should be able to inspect the current set of tests to give you ideas on how to write tests for recurrence.
A simple test might look like this:
/* global define, describe, beforeEach, afterEach, it */
define([
'expect',
'jquery',
'sinon',
'pat-registry',
'mockup-patterns-recurrence',
'mockup-patterns-select2'
], function(expect, $, sinon, registry, Recurrence) {
'use strict';
window.mocha.setup('bdd');
$.fx.off = true;
describe('Recurrence', function() {
beforeEach(function() {
this.$el = $('<div><input class="pat-recurrence" /></div>');
this.clock = sinon.useFakeTimers(new Date(2016,12,23,15,30).getTime());
});
afterEach(function() {
$('body').empty();
this.clock.restore();
});
it('should add recurrence-widget class', function() {
var self = this;
expect($('.pat-recurrence', self.$el).hasClass('recurrence-widget')).to.equal(true);
});
});
@vangheem That helps a lot. Thanks!
I would like to write the tests for the patterns recurrence and querystring, as a part of my application to gsoc this year. I'm assuming that they are required .
I would love to get some tips on how to proceed, because I couldn't find proper documentation on writing tests.