:)
This commit is contained in:
parent
e5e5e565df
commit
e97106d6ef
3 changed files with 7 additions and 6 deletions
|
@ -8,7 +8,7 @@ import 'package:uuid/uuid.dart';
|
||||||
final Uuid _uuid = new Uuid();
|
final Uuid _uuid = new Uuid();
|
||||||
|
|
||||||
Future<TestClient> connectTo(Angel app,
|
Future<TestClient> connectTo(Angel app,
|
||||||
{Map initialSession, bool saveSession: true}) async {
|
{Map initialSession, bool saveSession: false}) async {
|
||||||
TestClient client;
|
TestClient client;
|
||||||
var path = '/${_uuid.v1()}/${_uuid.v1()}/${_uuid.v1()}';
|
var path = '/${_uuid.v1()}/${_uuid.v1()}/${_uuid.v1()}';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ author: "Tobe O <thosakwe@gmail.com>"
|
||||||
description: "Testing utility library for the Angel framework."
|
description: "Testing utility library for the Angel framework."
|
||||||
homepage: "https://github.com/angel-dart/test.git"
|
homepage: "https://github.com/angel-dart/test.git"
|
||||||
name: "angel_test"
|
name: "angel_test"
|
||||||
version: "1.0.0-dev"
|
version: "1.0.0-dev+1"
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_client: "^1.0.0-dev+16"
|
angel_client: "^1.0.0-dev+16"
|
||||||
angel_framework: "^1.0.0-dev"
|
angel_framework: "^1.0.0-dev"
|
||||||
|
|
|
@ -35,19 +35,20 @@ main() {
|
||||||
|
|
||||||
group('session', () {
|
group('session', () {
|
||||||
test('initial session', () async {
|
test('initial session', () async {
|
||||||
final TestClient client =
|
final TestClient client = await connectTo(app,
|
||||||
await connectTo(app, initialSession: {'foo': 'bar'});
|
initialSession: {'foo': 'bar'}, saveSession: true);
|
||||||
expect(client.session['foo'], equals('bar'));
|
expect(client.session['foo'], equals('bar'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('add to session', () async {
|
test('add to session', () async {
|
||||||
final TestClient client = await connectTo(app);
|
final TestClient client = await connectTo(app, saveSession: true);
|
||||||
await client.addToSession({'michael': 'jackson'});
|
await client.addToSession({'michael': 'jackson'});
|
||||||
expect(client.session['michael'], equals('jackson'));
|
expect(client.session['michael'], equals('jackson'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('remove from session', () async {
|
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']);
|
await client.removeFromSession(['angel']);
|
||||||
expect(client.session.containsKey('angel'), isFalse);
|
expect(client.session.containsKey('angel'), isFalse);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue