privacy-policy-test.js 1.2 KB

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