privacy-policy-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: PrivacyPolicy', {
  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 /privacy-policy', function(assert) {
  15. Ember.$.mockjax({
  16. url: "/api/legal-pages/privacy-policy/",
  17. status: 404,
  18. responseText: {'detail': 'Not found'}
  19. });
  20. visit('/privacy-policy');
  21. andThen(function() {
  22. assert.equal(currentPath(), 'error-404');
  23. });
  24. });
  25. test('visiting set /privacy-policy', function(assert) {
  26. Ember.$.mockjax({
  27. url: "/api/legal-pages/privacy-policy/",
  28. status: 200,
  29. responseText: {
  30. 'id': 'privacy-policy',
  31. 'title': 'Privacy policy',
  32. 'link': '',
  33. 'body': '<p>Privacy policy is working!</p>'
  34. }
  35. });
  36. visit('/privacy-policy');
  37. andThen(function() {
  38. assert.equal(currentPath(), 'privacy-policy');
  39. var $e = find('article');
  40. assert.equal(Ember.$.trim($e.html()), '<p>Privacy policy is working!</p>');
  41. });
  42. });