コード例 #1
0
  test("#start throws if called while already started", function(assert) {
    FakeServer.start();

    assert.throws(
      FakeServer.start,
      /Cannot start FakeServer while already started/,
      "throws if FakeServer called while started"
    );
  });
コード例 #2
0
QUnit.testStart(function(){
  storage.remove(config.authTokenKey);
  MockLocation.setup();
  MockTitle.setup();

  stubAnalytics();
  FakeServer.start();
  stubStripe();
});
コード例 #3
0
export default function(name, options = {}) {
    module(name, {
        beforeEach() {
            this.application = startApp();
            FakeServer.start();
            manualSetup(this.application.__container__);
            const url = config.OSF.apiUrl;
            const provider = FactoryGuy.build('preprint-provider');

            stubRequest('get', `${url}/v2/users/me`, (request) => {
                request.unauthorized({});
            });
            stubRequest('get', `${url}/v2/preprint_providers`, (request) => {
                request.ok({
                    data: [{
                        attributes: provider.data.attributes,
                        type: 'preprint_providers',
                        id: 'osf',
                    }],
                });
            });
            stubRequest('get', `${url}/v2/preprint_providers/osf`, (request) => {
                request.ok({
                    data: {
                        attributes: provider.data.attributes,
                        type: 'preprint_providers',
                        id: 'osf',
                    },
                });
            });

            if (options.beforeEach) {
                return options.beforeEach.apply(this, arguments);
            }
        },
        afterEach() {
            FakeServer.stop();
            const afterEach = options.afterEach && options.afterEach.apply(this, arguments);
            return RSVP.resolve(afterEach).then(() => destroyApp(this.application));
        },
    });
}
コード例 #4
0
import { test } from 'qunit';
import FakeServer, { stubRequest } from 'ember-cli-fake-server';

import moduleForAcceptance from 'hospitalrun/tests/helpers/module-for-acceptance';
import runWithPouchDump from 'hospitalrun/tests/helpers/run-with-pouch-dump';
import { waitToAppear } from 'hospitalrun/tests/helpers/wait-to-appear';

moduleForAcceptance('Acceptance | login', {
  beforeEach() {
    FakeServer.start();
  },

  afterEach() {
    FakeServer.stop();
  }
});

test('visiting / redirects user to login', function(assert) {
  assert.expect(1);
  return runWithPouchDump('default', async function() {
    await visit('/');
    assert.equal(currentURL(), '/login');
  });
});

test('login with correct credentials', function(assert) {
  return login(assert);
});
test('login with correct credentials but space around username', function(assert) {
  return login(assert, true);
});
コード例 #5
0
 beforeEach: function() {
   FakeServer.start();
   this.application = startApp();
 },