pumuki 6.3.146 → 6.3.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -375,11 +375,34 @@ final class SyncTests: XCTestCase {
375
375
  }
376
376
  }
377
377
  }
378
+ `;
379
+ const brownfieldCompatibleUnitTest = `
380
+ import XCTest
381
+
382
+ final class LoginModelTests: XCTestCase {
383
+ func test_submit_validCredentials_storesSession() async throws {
384
+ let (sut, repository) = makeSUT()
385
+ try await sut.submit()
386
+ XCTAssertEqual(repository.receivedRequests.count, 1)
387
+ }
388
+
389
+ private func makeSUT(
390
+ file: StaticString = #filePath,
391
+ line: UInt = #line
392
+ ) -> (LoginModel, AuthRepositorySpy) {
393
+ let repository = AuthRepositorySpy()
394
+ let sut = LoginModel(repository: repository)
395
+ trackForMemoryLeaks(sut, testCase: self, file: file, line: line)
396
+ trackForMemoryLeaks(repository, testCase: self, file: file, line: line)
397
+ return (sut, repository)
398
+ }
399
+ }
378
400
  `;
379
401
 
380
402
  assert.equal(hasSwiftLegacyXCTestImportUsage(unitTest), true);
381
403
  assert.equal(hasSwiftLegacyXCTestImportUsage(uiTest), false);
382
404
  assert.equal(hasSwiftLegacyXCTestImportUsage(performanceTest), false);
405
+ assert.equal(hasSwiftLegacyXCTestImportUsage(brownfieldCompatibleUnitTest), false);
383
406
  });
384
407
 
385
408
  test('hasSwiftLegacySwiftUiObservableWrapperUsage detecta @StateObject/@ObservedObject legacy', () => {
@@ -476,11 +499,34 @@ final class LoginUITests: XCTestCase {
476
499
  app.launch()
477
500
  }
478
501
  }
502
+ `;
503
+ const brownfieldCompatibleSuite = `
504
+ import XCTest
505
+
506
+ final class LoginModelTests: XCTestCase {
507
+ func test_submit_validCredentials_storesSession() async throws {
508
+ let (sut, repository) = makeSUT()
509
+ try await sut.submit()
510
+ XCTAssertEqual(repository.receivedRequests.count, 1)
511
+ }
512
+
513
+ private func makeSUT(
514
+ file: StaticString = #filePath,
515
+ line: UInt = #line
516
+ ) -> (LoginModel, AuthRepositorySpy) {
517
+ let repository = AuthRepositorySpy()
518
+ let sut = LoginModel(repository: repository)
519
+ trackForMemoryLeaks(sut, testCase: self, file: file, line: line)
520
+ trackForMemoryLeaks(repository, testCase: self, file: file, line: line)
521
+ return (sut, repository)
522
+ }
523
+ }
479
524
  `;
480
525
 
481
526
  assert.equal(hasSwiftModernizableXCTestSuiteUsage(legacySuite), true);
482
527
  assert.equal(hasSwiftModernizableXCTestSuiteUsage(mixedSuite), false);
483
528
  assert.equal(hasSwiftModernizableXCTestSuiteUsage(uiSuite), false);
529
+ assert.equal(hasSwiftModernizableXCTestSuiteUsage(brownfieldCompatibleSuite), false);
484
530
  });
485
531
 
486
532
  test('hasSwiftMixedTestingFrameworksUsage detecta mezcla XCTestCase y Testing/@Test', () => {
@@ -549,6 +595,46 @@ final class BuyerCommerceUISmokeTests: XCTestCase {
549
595
  assert.equal(hasSwiftXCTUnwrapUsage(`${uiSource}\nlet value = try XCTUnwrap(optional)`), false);
550
596
  });
551
597
 
598
+ test('hasSwiftXCTestAssertionUsage excluye XCTest brownfield compatible y bloquea suites sin contrato de calidad', () => {
599
+ const compatibleSource = `
600
+ import XCTest
601
+
602
+ final class LoginModelTests: XCTestCase {
603
+ func test_submit_validCredentials_storesSession() async throws {
604
+ let (sut, repository) = makeSUT()
605
+ try await sut.submit()
606
+ XCTAssertEqual(repository.receivedRequests.count, 1)
607
+ let session = try XCTUnwrap(repository.savedSession)
608
+ XCTAssertEqual(session.userId, "buyer-1")
609
+ }
610
+
611
+ private func makeSUT(
612
+ file: StaticString = #filePath,
613
+ line: UInt = #line
614
+ ) -> (LoginModel, AuthRepositorySpy) {
615
+ let repository = AuthRepositorySpy()
616
+ let sut = LoginModel(repository: repository)
617
+ trackForMemoryLeaks(sut, testCase: self, file: file, line: line)
618
+ trackForMemoryLeaks(repository, testCase: self, file: file, line: line)
619
+ return (sut, repository)
620
+ }
621
+ }
622
+ `;
623
+ const missingQualityContract = `
624
+ import XCTest
625
+
626
+ final class LoginModelTests: XCTestCase {
627
+ func test_submit_validCredentials_storesSession() async throws {
628
+ XCTAssertEqual(repository.receivedRequests.count, 1)
629
+ }
630
+ }
631
+ `;
632
+
633
+ assert.equal(hasSwiftXCTestAssertionUsage(compatibleSource), false);
634
+ assert.equal(hasSwiftXCTUnwrapUsage(compatibleSource), false);
635
+ assert.equal(hasSwiftXCTestAssertionUsage(missingQualityContract), true);
636
+ });
637
+
552
638
  test('hasSwiftXCTUnwrapUsage detecta XCTUnwrap real y evita strings', () => {
553
639
  const source = `
554
640
  let value = try XCTUnwrap(optionalValue)
@@ -730,6 +730,30 @@ const hasSwiftLegacyXCTestMethodUsage = (source: string): boolean => {
730
730
  .length > 0;
731
731
  };
732
732
 
733
+ const hasSwiftMakeSutUsage = (source: string): boolean => {
734
+ return hasSwiftSanitizedRegexMatch(source, /\bmakeSUT\s*\(/);
735
+ };
736
+
737
+ const hasSwiftMemoryLeakTrackingUsage = (source: string): boolean => {
738
+ return hasSwiftSanitizedRegexMatch(source, /\btrackForMemoryLeaks\s*\(/);
739
+ };
740
+
741
+ const hasSwiftBrownfieldCompatibleXCTestUsage = (source: string): boolean => {
742
+ if (!hasSwiftXCTestImportUsage(source) || !hasSwiftXCTestCaseSubclassUsage(source)) {
743
+ return false;
744
+ }
745
+
746
+ if (!hasSwiftLegacyXCTestMethodUsage(source)) {
747
+ return false;
748
+ }
749
+
750
+ if (hasSwiftTestingImportUsage(source) || hasSwiftTestingSuiteAttributeUsage(source)) {
751
+ return false;
752
+ }
753
+
754
+ return hasSwiftMakeSutUsage(source) && hasSwiftMemoryLeakTrackingUsage(source);
755
+ };
756
+
733
757
  export const hasSwiftLegacyXCTestImportUsage = (source: string): boolean => {
734
758
  if (!hasSwiftXCTestImportUsage(source)) {
735
759
  return false;
@@ -739,6 +763,10 @@ export const hasSwiftLegacyXCTestImportUsage = (source: string): boolean => {
739
763
  return false;
740
764
  }
741
765
 
766
+ if (hasSwiftBrownfieldCompatibleXCTestUsage(source)) {
767
+ return false;
768
+ }
769
+
742
770
  return true;
743
771
  };
744
772
 
@@ -771,6 +799,10 @@ export const hasSwiftXCTestAssertionUsage = (source: string): boolean => {
771
799
  return false;
772
800
  }
773
801
 
802
+ if (hasSwiftBrownfieldCompatibleXCTestUsage(source)) {
803
+ return false;
804
+ }
805
+
774
806
  return (
775
807
  collectSwiftRegexLines(source, /\bXCTAssert[A-Za-z0-9_]*\s*\(/).length > 0 ||
776
808
  collectSwiftRegexLines(source, /\bXCTFail\s*\(/).length > 0
@@ -782,6 +814,10 @@ export const hasSwiftXCTUnwrapUsage = (source: string): boolean => {
782
814
  return false;
783
815
  }
784
816
 
817
+ if (hasSwiftBrownfieldCompatibleXCTestUsage(source)) {
818
+ return false;
819
+ }
820
+
785
821
  return collectSwiftRegexLines(source, /\bXCTUnwrap\s*\(/).length > 0;
786
822
  };
787
823
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.146",
3
+ "version": "6.3.147",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {