Created
December 12, 2019 11:12
-
-
Save sharpred/4c1facb71e158585685122ec25dac67c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:piota_api/src/config.dart' as appconfig; | |
import 'dart:io'; | |
import 'package:test/test.dart'; | |
void main() { | |
test('configfromJson', () async { | |
final file = File('/Users/paulryan/Documents/projects.nosync/flutter/piota/api/test/fixtures/app_config2.json'); | |
final str = await file.readAsString(); | |
final json = appconfig.configFromJson(str); | |
//print(str); | |
final data = json.data; | |
final settings = data.settings; | |
final tagline = settings.tagline; | |
final slogan = tagline.title; | |
final channels = settings.channels; | |
expect(slogan, "Welcome to our app! "); | |
expect(channels.length, 8); | |
expect(channels[0].title, "Urgent"); | |
}); | |
test('configtoJson', () async { | |
final file = File('/Users/paulryan/Documents/projects.nosync/flutter/piota/api/test/fixtures/app_config2.json'); | |
final str = await file.readAsString(); | |
final json = appconfig.configFromJson(str); | |
//print(str); | |
final str2 = appconfig.configToJson(json); | |
final json2 = appconfig.configFromJson(str2); | |
final data = json2.data; | |
final settings = data.settings; | |
final tagline = settings.tagline; | |
final slogan = tagline.title; | |
final channels = settings.channels; | |
expect(slogan, "Welcome to our app! "); | |
expect(channels.length, 8); | |
expect(channels[0].title, "Urgent"); | |
expect(channels[0].channel, "grangehill_all"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment