Last active
October 14, 2017 22:37
-
-
Save badrinathvm/d75f89344981dfb6ce37bc4e06d9b738 to your computer and use it in GitHub Desktop.
Unit Test skeleton
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
override func spec() { | |
var watch : Watch! | |
//Component (i.e., Watch Modal Data ) in test | |
describe("Watch Modal Data Tests"){ | |
//Preparation of data | |
beforeEach { | |
watch = Watch(name: "Men's Business Quartz Watch CAGNARY 6828", | |
price: 11.69, brand: Brand(id: 6828, name: "CAGARNY")) | |
} | |
// state of test case to be verified. | |
context("When Watch Model Data is available"){ | |
//Prepare brand data | |
beforeEach{ | |
brandInformation = watch.brand | |
} | |
it("Watch Model data Validations ") { | |
//Data Validations | |
expect(watch.name).to(beAnInstanceOf(String.self)) | |
expect(watch.name).to(contain("Men's Business Quartz Watch CAGNARY 6828")) | |
expect(brandInformation.name).to(equal("CAGARNY")) | |
expect(brandInformation.name).to(beginWith("CAG")) | |
expect(brandInformation.name).toNot(beNil()) | |
//type check | |
expect(watch).to(beAKindOf(Watch.self)) | |
expect(watch).toNot(beAKindOf(Dummy.self)) | |
//instance check | |
expect(watch).to(beAnInstanceOf(Watch.self)) | |
expect(watch).toNot(beAnInstanceOf(Dummy.self)) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment