<commit_before>import 'package:firebase/firebase.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

const TEST_URL = 'https://dart-test.firebaseio-demo.com/test/';

// Update TEST_URL to a valid URL and update AUTH_KEY to a corresponding
// key to test authentication.
const AUTH_KEY = null;

const INVALID_TOKEN = '<KEY>';

final _now = new DateTime.now().toUtc();
final _dateKey = _now.toIso8601String();

final _replaceRegExp = new RegExp(r'[\.]');

final _testKey = '$_dateKey'.replaceAll(_replaceRegExp, '_');

final _testUrl = TEST_URL + _testKey + '/';

void main() {
  useHtmlConfiguration();

  Firebase f;

  setUp(() {
    f = new Firebase(_testUrl);
  });

  tearDown(() {
    if (f != null) {
      f.unauth();
      f = null;
    }
  });

  group('auth', () {

    test('bad auth should fail', () {
      expect(f.auth(INVALID_TOKEN), throwsA((error) {
        expect(error['code'], 'INVALID_TOKEN');
        return true;
      }));
    });

    if (AUTH_KEY != null) {
      test('good auth key', () {<commit_msg>better rendering of tests<commit_after>import 'package:firebase/firebase.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';

const TEST_URL = 'https://dart-test.firebaseio-demo.com/test/';

// Update TEST_URL to a valid URL and update AUTH_KEY to a corresponding
// key to test authentication.
const AUTH_KEY = null;

const INVALID_TOKEN = '<KEY>';

final _now = new DateTime.now().toUtc();
final _dateKey = _now.toIso8601String();

final _replaceRegExp = new RegExp(r'[\.]');

final _testKey = '$_dateKey'.replaceAll(_replaceRegExp, '_');

final _testUrl = TEST_URL + _testKey + '/';

void main() {
  useHtmlConfiguration();
  groupSep = ' - ';

  Firebase f;

  setUp(() {
    f = new Firebase(_testUrl);
  });

  tearDown(() {
    if (f != null) {
      f.unauth();
      f = null;
    }
  });

  group('auth', () {

    test('bad auth should fail', () {
      expect(f.auth(INVALID_TOKEN), throwsA((error) {
        expect(error['code'], 'INVALID_TOKEN');
        return true;
      }));
    });

    if (AUTH_KEY != null) {
      test('good auth key', () {
{'fraction_non_alphanumeric': 0.1662062615101289, 'fraction_numerical': 0.003683241252302026, 'mean_word_length': 3.381048387096774, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3985619', 'n_tokens_mistral': 752, 'n_tokens_neox': 744, 'n_words': 168}