This commit is contained in:
thosakwe 2016-12-18 23:51:21 -05:00
parent e5e5e565df
commit e97106d6ef
3 changed files with 7 additions and 6 deletions

View file

@ -8,7 +8,7 @@ import 'package:uuid/uuid.dart';
final Uuid _uuid = new Uuid();
Future<TestClient> connectTo(Angel app,
{Map initialSession, bool saveSession: true}) async {
{Map initialSession, bool saveSession: false}) async {
TestClient client;
var path = '/${_uuid.v1()}/${_uuid.v1()}/${_uuid.v1()}';

View file

@ -2,7 +2,7 @@ author: "Tobe O <thosakwe@gmail.com>"
description: "Testing utility library for the Angel framework."
homepage: "https://github.com/angel-dart/test.git"
name: "angel_test"
version: "1.0.0-dev"
version: "1.0.0-dev+1"
dependencies:
angel_client: "^1.0.0-dev+16"
angel_framework: "^1.0.0-dev"

View file

@ -35,19 +35,20 @@ main() {
group('session', () {
test('initial session', () async {
final TestClient client =
await connectTo(app, initialSession: {'foo': 'bar'});
final TestClient client = await connectTo(app,
initialSession: {'foo': 'bar'}, saveSession: true);
expect(client.session['foo'], equals('bar'));
});
test('add to session', () async {
final TestClient client = await connectTo(app);
final TestClient client = await connectTo(app, saveSession: true);
await client.addToSession({'michael': 'jackson'});
expect(client.session['michael'], equals('jackson'));
});
test('remove from session', () async {
final TestClient client = await connectTo(app, initialSession: {'angel': 'framework'});
final TestClient client = await connectTo(app,
initialSession: {'angel': 'framework'}, saveSession: true);
await client.removeFromSession(['angel']);
expect(client.session.containsKey('angel'), isFalse);
});