Skip to content

Commit 50872ac

Browse files
committed
Update GameControllerBarcodeParserTests naming
1 parent 83a5560 commit 50872ac

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

WooCommerce/WooCommerceTests/POS/Presentation/Barcode Scanning/GameControllerBarcodeParserTests.swift

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct GameControllerBarcodeParserTests {
88

99
struct ConfigurationTests {
1010
@Test("default configuration has expected values")
11-
func defaultConfiguration_whenRequested_hasExpectedValues() {
11+
func default_configuration_when_requested_has_expected_values() {
1212
// Given
1313
let configuration = HIDBarcodeParserConfiguration.default
1414

@@ -19,7 +19,7 @@ struct GameControllerBarcodeParserTests {
1919
}
2020

2121
@Test("custom configuration accepts specified values")
22-
func customConfiguration_whenCreated_acceptsSpecifiedValues() {
22+
func custom_configuration_when_created_accepts_specified_values() {
2323
// Given
2424
let customTerminators: Set<String> = ["\t", " ", "\r"]
2525
let customMinLength = 4
@@ -43,7 +43,7 @@ struct GameControllerBarcodeParserTests {
4343

4444
struct BasicScanningTests {
4545
@Test("complete scan succeeds with valid barcode")
46-
func validBarcode_whenScannedCompletely_succeeds() {
46+
func valid_barcode_when_scanned_completely_succeeds() {
4747
// Given
4848
var results: [HIDBarcodeParserResult] = []
4949
let parser = GameControllerBarcodeParser(
@@ -70,7 +70,7 @@ struct GameControllerBarcodeParserTests {
7070
}
7171

7272
@Test("multiple consecutive scans work correctly")
73-
func multipleBarcodes_whenScannedConsecutively_workCorrectly() {
73+
func multiple_barcodes_when_scanned_consecutively_work_correctly() {
7474
// Given
7575
var results: [HIDBarcodeParserResult] = []
7676
let parser = GameControllerBarcodeParser(
@@ -105,7 +105,7 @@ struct GameControllerBarcodeParserTests {
105105
}
106106

107107
@Test("cancelled scan clears buffer and allows new scan")
108-
func partialScan_whenCancelled_clearsBufferAndAllowsNewScan() {
108+
func partial_scan_when_cancelled_clears_buffer_and_allows_new_scan() {
109109
// Given
110110
var results: [HIDBarcodeParserResult] = []
111111
let parser = GameControllerBarcodeParser(
@@ -148,7 +148,7 @@ struct GameControllerBarcodeParserTests {
148148

149149
struct ErrorHandlingTests {
150150
@Test("scan too short triggers error with default configuration")
151-
func shortBarcode_whenScannedWithDefaultConfig_triggersError() {
151+
func short_barcode_when_scanned_with_default_config_triggers_error() {
152152
// Given
153153
var results: [HIDBarcodeParserResult] = []
154154
let parser = GameControllerBarcodeParser(
@@ -179,7 +179,7 @@ struct GameControllerBarcodeParserTests {
179179
}
180180

181181
@Test("scan too short triggers error with custom configuration")
182-
func shortBarcode_whenScannedWithCustomConfig_triggersError() {
182+
func short_barcode_when_scanned_with_custom_config_triggers_error() {
183183
// Given
184184
var results: [HIDBarcodeParserResult] = []
185185
let configuration = HIDBarcodeParserConfiguration(
@@ -217,7 +217,7 @@ struct GameControllerBarcodeParserTests {
217217
}
218218

219219
@Test("slow typing triggers timeout error")
220-
func slowTyping_whenExceedsTimeout_triggersError() {
220+
func slow_typing_when_exceeds_timeout_triggers_error() {
221221
// Given
222222
var results: [HIDBarcodeParserResult] = []
223223
let configuration = HIDBarcodeParserConfiguration(
@@ -264,7 +264,7 @@ struct GameControllerBarcodeParserTests {
264264
}
265265

266266
@Test("fast typing within timeout succeeds")
267-
func fastTyping_whenWithinTimeout_succeeds() {
267+
func fast_typing_when_within_timeout_succeeds() {
268268
// Given
269269
var results: [HIDBarcodeParserResult] = []
270270
let configuration = HIDBarcodeParserConfiguration.default
@@ -300,7 +300,7 @@ struct GameControllerBarcodeParserTests {
300300
}
301301

302302
@Test("proactive timeout triggers error without next character")
303-
func timeout_whenTimerFires_triggersTimeoutError() {
303+
func timeout_when_timer_fires_triggers_timeout_error() {
304304
// Given
305305
var results: [HIDBarcodeParserResult] = []
306306
let configuration = HIDBarcodeParserConfiguration(
@@ -338,7 +338,7 @@ struct GameControllerBarcodeParserTests {
338338
}
339339

340340
@Test("timer cancelled on successful scan completion")
341-
func timerCancelled_whenScanCompletes_preventsTimeoutError() {
341+
func timer_cancelled_when_scan_completes_prevents_timeout_error() {
342342
// Given
343343
var results: [HIDBarcodeParserResult] = []
344344
let configuration = HIDBarcodeParserConfiguration(
@@ -372,7 +372,7 @@ struct GameControllerBarcodeParserTests {
372372
}
373373

374374
@Test("timer cancelled on manual scan cancellation")
375-
func timerCancelled_whenScanCancelled_preventsTimeoutError() {
375+
func timer_cancelled_when_scan_cancelled_prevents_timeout_error() {
376376
// Given
377377
var results: [HIDBarcodeParserResult] = []
378378
let configuration = HIDBarcodeParserConfiguration(
@@ -401,7 +401,7 @@ struct GameControllerBarcodeParserTests {
401401
}
402402

403403
@Test("new character input cancels previous timer and starts new one")
404-
func newCharacterInput_whenReceived_cancelsOldTimerAndStartsNew() {
404+
func new_character_input_when_received_cancels_old_timer_and_starts_new() {
405405
// Given
406406
var results: [HIDBarcodeParserResult] = []
407407
let configuration = HIDBarcodeParserConfiguration(
@@ -444,7 +444,7 @@ struct GameControllerBarcodeParserTests {
444444
}
445445

446446
@Test("scan duration is properly tracked for successful scan")
447-
func scanDuration_whenSuccessfulScan_isProperlyTracked() {
447+
func scan_duration_when_successful_scan_is_properly_tracked() {
448448
// Given
449449
var results: [HIDBarcodeParserResult] = []
450450
let mockTimeProvider = MockTimeProvider()
@@ -477,7 +477,7 @@ struct GameControllerBarcodeParserTests {
477477
}
478478

479479
@Test("scan duration is properly tracked for failed scan")
480-
func scanDuration_whenFailedScan_isProperlyTracked() {
480+
func scan_duration_when_failed_scan_is_properly_tracked() {
481481
// Given
482482
var results: [HIDBarcodeParserResult] = []
483483
let mockTimeProvider = MockTimeProvider()
@@ -509,7 +509,7 @@ struct GameControllerBarcodeParserTests {
509509
}
510510

511511
@Test("empty scan with only terminator is ignored")
512-
func emptyBuffer_whenTerminatorSent_isIgnored() {
512+
func empty_buffer_when_terminator_sent_is_ignored() {
513513
// Given
514514
var results: [HIDBarcodeParserResult] = []
515515
let parser = GameControllerBarcodeParser(
@@ -536,7 +536,7 @@ struct GameControllerBarcodeParserTests {
536536

537537
struct ExcludedKeysTests {
538538
@Test("modifier keys are excluded from scan input")
539-
func modifierKeys_whenPressed_areExcludedFromScanInput() {
539+
func modifier_keys_when_pressed_are_excluded_from_scan_input() {
540540
// Given
541541
var results: [HIDBarcodeParserResult] = []
542542
let parser = GameControllerBarcodeParser(
@@ -564,7 +564,7 @@ struct GameControllerBarcodeParserTests {
564564
}
565565

566566
@Test("arrow keys are excluded from scan input")
567-
func arrowKeys_whenPressed_areExcludedFromScanInput() {
567+
func arrow_keys_when_pressed_are_excluded_from_scan_input() {
568568
// Given
569569
var results: [HIDBarcodeParserResult] = []
570570
let parser = GameControllerBarcodeParser(
@@ -591,7 +591,7 @@ struct GameControllerBarcodeParserTests {
591591
}
592592

593593
@Test("function and system keys are excluded from scan input")
594-
func systemKeys_whenPressed_areExcludedFromScanInput() {
594+
func system_keys_when_pressed_are_excluded_from_scan_input() {
595595
// Given
596596
var results: [HIDBarcodeParserResult] = []
597597
let parser = GameControllerBarcodeParser(
@@ -619,7 +619,7 @@ struct GameControllerBarcodeParserTests {
619619
}
620620

621621
@Test("navigation keys are excluded from scan input")
622-
func navigationKeys_whenPressed_areExcludedFromScanInput() {
622+
func navigation_keys_when_pressed_are_excluded_from_scan_input() {
623623
// Given
624624
var results: [HIDBarcodeParserResult] = []
625625
let parser = GameControllerBarcodeParser(
@@ -659,7 +659,7 @@ struct GameControllerBarcodeParserTests {
659659

660660
struct TerminatorTests {
661661
@Test("carriage return terminates scan")
662-
func carriageReturn_whenPressed_terminatesScan() {
662+
func carriage_return_when_pressed_terminates_scan() {
663663
// Given
664664
var results: [HIDBarcodeParserResult] = []
665665
let parser = GameControllerBarcodeParser(
@@ -683,7 +683,7 @@ struct GameControllerBarcodeParserTests {
683683
}
684684

685685
@Test("multiple terminating strings work correctly")
686-
func multipleTerminators_whenConfigured_workCorrectly() {
686+
func multiple_terminators_when_configured_work_correctly() {
687687
// Given
688688
var results: [HIDBarcodeParserResult] = []
689689
let configuration = HIDBarcodeParserConfiguration(
@@ -735,7 +735,7 @@ struct GameControllerBarcodeParserTests {
735735
}
736736

737737
@Test("terminator at start of empty buffer is ignored")
738-
func emptyBuffer_whenTerminatorPressed_isIgnored() {
738+
func empty_buffer_when_terminator_pressed_is_ignored() {
739739
// Given
740740
var results: [HIDBarcodeParserResult] = []
741741
let parser = GameControllerBarcodeParser(
@@ -753,7 +753,7 @@ struct GameControllerBarcodeParserTests {
753753
}
754754

755755
@Test("terminator in middle of scan is included in barcode")
756-
func nonTerminatorCharacter_whenPressed_isIncludedInBarcode() {
756+
func non_terminator_character_when_pressed_is_included_in_barcode() {
757757
// Given
758758
var results: [HIDBarcodeParserResult] = []
759759
let configuration = HIDBarcodeParserConfiguration(
@@ -778,7 +778,7 @@ struct GameControllerBarcodeParserTests {
778778
}
779779

780780
@Test("parser does not start a timeout for an ignored character")
781-
func emptyBuffer_whenIgnoredCharacterPressed_doesNotStartTimeout() {
781+
func empty_buffer_when_ignored_character_pressed_does_not_start_timeout() {
782782
// Given
783783
var results: [HIDBarcodeParserResult] = []
784784
let mockTimeProvider = MockTimeProvider()

0 commit comments

Comments
 (0)