content: function IdentityTests(t)
      t.describe("Identity Tests", sub(t)
          t.beforeEach(sub(t)
              configurePurchases({ t: t })
          end sub)
  
          t.it("Can check if user is anonymous", sub(t)
              result = Purchases().isAnonymous(sub(result, error)
                  m.t.assert.isTrue(result, "Expected anonymous user id")
                  m.t.assert.isInvalid(error, "Unexpected error")
              end sub)
              t.assert.isTrue(result, "Expected anonymous user id")
              t.assert.isTrue(Purchases().isAnonymous(), "Expected anonymous user id")
          end sub)
  
          t.it("Can retrieve app user id", sub(t)
              result = Purchases().appUserId(sub(result, error)
                  m.t.assert.isInvalid(error, "Unexpected error")
                  m.t.assert.isTrue(result.startsWith("$RCAnonymousID:"), "Expected anonymous user id")
              end sub)
              t.assert.isValid(result, "Unexpected result")
              t.assert.isValid(Purchases().appUserId(), "Unexpected result")
          end sub)
  
          t.it("Generates anonymous user ids", sub(t)
              Purchases().isAnonymous(sub(result, error)
                  m.t.assert.isTrue(result, "Expected anonymous user id")
                  Purchases().appUserId(sub(result, error)
                      m.t.assert.isTrue(result.startsWith("$RCAnonymousID:"), "Expected anonymous user id")
                  end sub)
              end sub)
          end sub)
  
          t.it("Logs in with app user id", sub(t)
              Purchases().logIn("myappuserid", sub(subscriber, error)
                  Purchases().isAnonymous(sub(result, error)
                      m.t.assert.isFalse(result, "Expected non-anonymous user id")
                  end sub)
                  Purchases().appUserId(sub(result, error)
                      m.t.assert.equal(result, "myappuserid", "Unexpected user id")
                  end sub)
  
                  userId = internalTestPurchases().api.identifyInputArgs.userId
                  m.t.assert.isTrue(type(userId) = "roString" or type(userId) = "String", "Unexpected user id type")
                  newUserId = internalTestPurchases().api.identifyInputArgs.newUserId
                  m.t.assert.isTrue(type(newUserId) = "roString" or type(newUserId) = "String", "Unexpected new user id type")
                  m.t.assert.equal(newUserId, "myappuserid", "Unexpected new user id")
  
                  m.t.assert.isInvalid(error, "Unexpected error")
                  assertSubscriberIsValid(m.t, subscriber)
              end sub)
          end sub)
  
          t.it("Returns error when using invalid id", sub(t)
              Purchases().logIn("", sub(subscriber, error)
                  Purchases().isAnonymous(sub(result, error)
                      m.t.assert.isTrue(result, "Unxpected non-anonymous user id")
                  end sub)
                  m.t.assert.isValid(error, "Expected error")
                  m.t.assert.isInvalid(subscriber, "Unexpected data")
                  m.t.assert.equal(error.code, internalTestPurchases().errors.invalidAppUserIdError.code, "Unexpected error code")
              end sub)
          end sub)
  
          t.it("Log out generates new anonymous id", sub(t)
              Purchases().isAnonymous(sub(result, error)
                  m.t.assert.isTrue(result, "Expected anonymous user id")
              end sub)
              Purchases().appUserId(sub(result, error)
                  m.t.assert.isTrue(result.startsWith("$RCAnonymousID:"), "Expected anonymous user id")
                  m.initialAnonymousId = result
              end sub)
              Purchases().logIn("myappuserid", sub(subscriber, error)
                  m.t.assert.isInvalid(error, "Unexpected error")
                  assertSubscriberIsValid(m.t, subscriber)
              end sub)
              Purchases().isAnonymous(sub(result, error)
                  m.t.assert.isFalse(result, "Expected non-anonymous user id")
              end sub)
              Purchases().appUserId(sub(result, error)
                  m.t.assert.equal(result, "myappuserid", "Unexpected user id")
              end sub)
              Purchases().logOut(sub(result, error)
                  m.t.assert.isInvalid(error, "Unexpected error")
                  m.t.assert.isValid(result, "Unexpected result")
                  Purchases().isAnonymous(sub(result, error)
                      m.t.assert.isTrue(result, "Expected anonymous user id")
                  end sub)
  
                  Purchases().appUserId(sub(result, error)
                      m.t.assert.isTrue(result.startsWith("$RCAnonymousID:"), "Expected anonymous user id")
                      m.t.assert.notEqual(result, m.initialAnonymousId, "Unexpected user id")
                  end sub)
  
                  userId = internalTestPurchases().api.identifyInputArgs.userId
                  m.t.assert.isTrue(type(userId) = "roString" or type(userId) = "String", "Unexpected user id type")
                  m.t.assert.equal(userId, "myappuserid", "Unexpected old user id")
                  newUserId = internalTestPurchases().api.identifyInputArgs.newUserId
                  m.t.assert.isTrue(type(newUserId) = "roString" or type(newUserId) = "String", "Unexpected new user id type")
  
                  m.t.assert.isInvalid(error, "Unexpected error")
                  assertSubscriberIsValid(m.t, result)
              end sub)
          end sub)
      end sub)
  end function