test('it merges the profile and token info, ignoring a previous profile attribute', function(assert) {
    freezeDateAt(new Date('1993-12-10T08:44:00'));
    assert.expect(1);

    const issuedAt = now();

    let profile = {
      my_key: 'foo'
    };

    let tokenInfo = {
      idToken: 'aaa.bbbb.ccc',
      profile: { some: 'stuff' }
    };

    let expectedResult = {
      issuedAt: issuedAt,
      idToken: 'aaa.bbbb.ccc',
      profile,
    };

    let result = createSessionDataObject(profile, tokenInfo);
    assert.deepEqual(result, expectedResult);
    unfreezeDate();
  });
  test('it sets the correct expiration time if the expiresIn header exists', function(assert) {
    freezeDateAt(new Date('1993-12-10T08:44:00'));

    assert.expect(1);
    const issuedAt = now();
    const subject = this.subject({
      session: {
        isAuthenticated: true,
        data: {
          authenticated: {
            expiresIn: 10,
            issuedAt: issuedAt
          },
        },
      },
    });

    assert.equal(get(subject, '_expiresAt'), issuedAt + 10);
    unfreezeDate();
  });
  test('it merges the profile and token info', function(assert) {
    freezeDateAt(new Date('1993-12-10T08:44:00'));
    assert.expect(1);

    const issuedAt = now();

    let profile = {
      my_key: 'foo'
    };

    let tokenInfo = {
      idToken: 'aaa.bbbb.ccc'
    };

    let expectedResult = { issuedAt: issuedAt };
    assign(expectedResult, { profile }, tokenInfo);

    let result = createSessionDataObject(profile, tokenInfo);
    assert.deepEqual(result, expectedResult);
    unfreezeDate();
  });
  test('it sets the correct expiration time if the id token exists', function(assert) {
    freezeDateAt(new Date('1993-12-10T08:44:00'));

    assert.expect(1);
    const issuedAt = now();
    const subject = this.subject({
      session: {
        isAuthenticated: true,
        data: {
          authenticated: {
            expiresIn: 12, // should NOT match
            idTokenPayload: {
              iat: issuedAt,
              exp: issuedAt + 10
            }
          },
        },
      },
    });

    assert.equal(get(subject, '_expiresAt'), issuedAt + 10);
    unfreezeDate();
  });