terms-of-service-test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import Ember from 'ember';
  2. import { module, test } from 'qunit';
  3. import startApp from '../helpers/start-app';
  4. var application;
  5. module('Acceptance: TermsOfService', {
  6. beforeEach: function() {
  7. application = startApp();
  8. },
  9. afterEach: function() {
  10. Ember.run(application, 'destroy');
  11. Ember.$.mockjax.clear();
  12. }
  13. });
  14. test('visiting unset /terms-of-service', function(assert) {
  15. Ember.$.mockjax({
  16. url: "/api/legal-pages/terms-of-service/",
  17. status: 404,
  18. responseText: {'detail': 'Not found'}
  19. });
  20. visit('/terms-of-service');
  21. andThen(function() {
  22. assert.equal(currentPath(), 'error-404');
  23. });
  24. });
  25. test('visiting set /terms-of-service', function(assert) {
  26. Ember.$.mockjax({
  27. url: "/api/legal-pages/terms-of-service/",
  28. status: 200,
  29. responseText: {
  30. 'id': 'terms-of-service',
  31. 'title': 'Terms of service',
  32. 'link': '',
  33. 'body': '<p>Top kek</p>'
  34. }
  35. });
  36. visit('/terms-of-service');
  37. andThen(function() {
  38. assert.equal(currentPath(), 'terms-of-service');
  39. var $e = find('article');
  40. assert.equal(Ember.$.trim($e.html()), '<p>Top kek</p>');
  41. });
  42. });