changeset 120:cd801949925b

Remove 1000 from default currency conversion
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Sun, 15 Aug 2021 11:10:39 +0100
parents f9d8b3c6597f
children 81ea5f034437
files Simoleon/Conversion.swift Simoleon/Helpers/ConversionBox.swift SimoleonTests/SimoleonTests.swift
diffstat 3 files changed, 2 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Simoleon/Conversion.swift	Sun Aug 15 09:58:17 2021 +0100
+++ b/Simoleon/Conversion.swift	Sun Aug 15 11:10:39 2021 +0100
@@ -12,7 +12,7 @@
     var showNavigationView: Bool?
     
     @State var currencyPair: String
-    @State private var amountToConvert = "1000"
+    @State private var amountToConvert = ""
     @State private var price: Double = 1.00
     @State private var showingConversion = false
     @State private var showingCurrencySelector = false
--- a/Simoleon/Helpers/ConversionBox.swift	Sun Aug 15 09:58:17 2021 +0100
+++ b/Simoleon/Helpers/ConversionBox.swift	Sun Aug 15 11:10:39 2021 +0100
@@ -40,7 +40,6 @@
                 .keyboardType(.decimalPad)
                 .font(Font.title.weight(.semibold))
                 .lineLimit(1)
-                .padding(.bottom, 10)
             }
             
             Divider()
@@ -68,7 +67,7 @@
      else:
      * Return zero
      */
-    private func makeConversion() -> Double {
+    func makeConversion() -> Double {
         if let amountToConvert = Double(amountToConvert) {
             return amountToConvert * price  // Conversion
         } else {
--- a/SimoleonTests/SimoleonTests.swift	Sun Aug 15 09:58:17 2021 +0100
+++ b/SimoleonTests/SimoleonTests.swift	Sun Aug 15 11:10:39 2021 +0100
@@ -17,40 +17,6 @@
     override func tearDownWithError() throws {
         // Put teardown code here. This method is called after the invocation of each test method in the class.
     }
-    
-    func testMakeConversion() {
-        // Given
-        let testAmounts = ["iawuh", Int(100), Float(3450.30), Double(12530.43435)] as [Any]
-        
-        for var amountToConvert in testAmounts {
-            // When
-            if let amountToConvert = amountToConvert as? Double {
-                // Then
-                XCTAssertEqual(amountToConvert, amountToConvert, "Amount to convert is not returning correctly")
-            } else {
-                // Then
-                amountToConvert = Int(0)
-                XCTAssertEqual(amountToConvert as! Int, 0, "Amount to convert must be 0")
-            }
-        }
-    }
-    
-    func testFormatCurrency() {
-        // Given
-        let availableIdentifiers = Locale.availableIdentifiers
-        let amount: NSDecimalNumber = 1000
-        
-        for identifier in availableIdentifiers {
-            let locale = Locale(identifier: identifier)
-            
-            let formatter = NumberFormatter()
-            formatter.locale = locale
-            formatter.numberStyle = .currency
-            
-            XCTAssertTrue((formatter.string(from: amount as NSNumber) != nil))
-        }
-        
-    }
 
     func testPerformanceExample() throws {
         // This is an example of a performance test case.