Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
912 B

  1. var template, expect, examples;
  2. if (typeof require !== 'undefined') {
  3. template = require('../lib/url-template.js');
  4. expect = require("expect.js");
  5. examples = require('../uritemplate-test/spec-examples-by-section.json');
  6. } else {
  7. template = window.urltemplate;
  8. expect = window.expect;
  9. examples = window.examples;
  10. }
  11. function createTestContext(c) {
  12. return function (t, r) {
  13. if (typeof r === 'string') {
  14. expect(template.parse(t).expand(c)).to.eql(r);
  15. } else {
  16. expect(r.indexOf(template.parse(t).expand(c)) >= 0).to.be.ok();
  17. }
  18. };
  19. }
  20. describe('spec-examples', function () {
  21. Object.keys(examples).forEach(function (section) {
  22. var assert = createTestContext(examples[section].variables);
  23. examples[section].testcases.forEach(function (testcase) {
  24. it(section + ' ' + testcase[0], function () {
  25. assert(testcase[0], testcase[1]);
  26. });
  27. });
  28. });
  29. });