Commit graph

798 commits

Author SHA1 Message Date
Tim Oliver
a18565b8b2 Add coverage to catch inconsistency exception
Summary:
Added a unit test to cover the inconsistency exception catch we added to capture the crashes caused by the new collection view behaviour in iOS 16.4.

The test deliberately puts the collection view state and the model state out of alignment, and then tests that the exception correctly occurs as expected.

Reviewed By: fabiomassimo

Differential Revision: D50072956

fbshipit-source-id: 4097cc0451d55d1a148156c783fe42654821113c
2023-10-11 22:30:36 -07:00
Tim Oliver
2bdbc1201a Add explicit activesupport version as CocoaPods dependency (#1590)
Summary:
## Changes in this pull request

All of the tests started failing today with a cryptic Ruby error. It turns out that a new version of `activesupport`, a dependency of CocoaPods was released and it introduced a bug. CocoaPods wasn't referencing a direct version of `activesupport` required, and so it was automatically trying to pull in this new invalid version.

This PR fixes the issue by explicitly specifying the last known good version of the dependency in the `Gemfile`.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1590

Test Plan: Tested and confirmed on my own fork of IGListKit this resolves the CocoaPods issue

Reviewed By: fabiomassimo

Differential Revision: D50013182

Pulled By: TimOliver

fbshipit-source-id: 623eab49dea5ff0b589b6f06ce589e99873dece4
2023-10-11 21:30:06 -07:00
Tim Oliver
2644442595 Add symlink for new IGListArrayUtilsInternal.m (#1591)
Summary:
## Changes in this pull request

I moved the functions from ` IGListArrayUtilsInternal.h` to `IGListArrayUtilsInternal.m` to ensure the code was properly captured for code coverage, but I forgot to re-run the SPM script to generate a new symlink for it. This should fix the failing sample app build tests.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1591

Test Plan: Confirmed this lets the sample apps run again.

Reviewed By: fabiomassimo

Differential Revision: D50013194

Pulled By: TimOliver

fbshipit-source-id: ff4bebae781ebb460915458848cb340a89401a83
2023-10-11 21:26:45 -07:00
Kent Sutherland
7256bfb51b Update iOS deployment target to silence Xcode 15 warnings (#1589)
Summary:
## Changes in this pull request

Xcode 15 has moved the iOS deployment target up to iOS 12 (just like https://github.com/Instagram/IGListKit/issues/1573 for Xcode 14). I did not modify the changelog because there's already an entry there for iOS 11 and macOS 10.13.

This also includes a build error fix for IGWarnAssert (dffcd4d0c8). I tried running the unit tests but a number of them are failing from previous changes.

### Checklist

- [ ] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1589

Reviewed By: fabiomassimo

Differential Revision: D50013207

Pulled By: TimOliver

fbshipit-source-id: 6c7a7b2ca3dd1265f11e85979432eded3292ed06
2023-10-11 21:26:38 -07:00
Tim Oliver
ebbc90961b Add coverage to updater class
Summary: This diff adds a small, essentially no-op test to add coverage to the `isInDataUpdateBlock` method of `IGListReloadDataUpdater`.

Differential Revision: D49906263

fbshipit-source-id: e59a04721d6af58cc2b6148cd688be8225bf3fb8
2023-10-06 03:08:34 -07:00
Tim Oliver
8840ad2bc8 Update IGListCollectionViewTests for new collection view behaviour
Summary:
It seems the under-the-hood changes made to `UICollectionView` from iOS 16.4 onwards has changed our expectations of how these tests work.

When initially testing, it seemed that the new behaviour was that the existing cell in the view would get updated, but any newly inserted cells wouldn't be added to the collection view yet.

Thinking this might simply be invalid behaviour when the collection view isn't added to a superview, I added the collection view to a new `UIWindow` instance. When I re-ran the tests again while the view has a superview, all of the views update correctly, and none of them were left in a partial state.

I'm not too sure what the original intent of testing the collection view cells for being in a partially updated state was, but I think we need to reconsider that for this new `UICollectionView` behaviour.

Differential Revision: D49906268

fbshipit-source-id: 7fdc7ba3a534bd49a8a0684888283d2d1eba5912
2023-10-06 03:08:34 -07:00
Tim Oliver
749a65b1bf Fix failing cell sizing test with IGListCollectionViewLayout
Summary:
This test started failing in Xcode 15. It looks like now, the default behaviour of `UICollectionView` is to not perform cell sizing until the next layout pass. As such, the sizing of the cells were invalid until `layoutIfNeeded` is first called.

Adding this line to the test brings it back to all of the expected values.

Differential Revision: D49906272

fbshipit-source-id: cc05cb2e105521b2576b2b2013d06e6285f4e8a4
2023-10-06 03:08:34 -07:00
Tim Oliver
51a3cb140e Refactored inline header function to proper implementation file
Summary:
`objectsWithDuplicateIdentifiersRemoved` was originally defined as a static function entirely within the `IGListArrayUtilsInternal.h` header. However it appears that Xcode can't perform code coverage analysis on implementation code in header files, so the coverage for this function was getting skipped.

This refactors the function so the code is properly arranged in an implementation file.

Differential Revision: D49901041

fbshipit-source-id: cb409343247451028634ca4d3d7b63e5670b5e1a
2023-10-06 03:08:34 -07:00
Tim Oliver
312e0a03ba Add coverage for testing initial and final layout attributes without a transitioning delegate
Summary: Duplicates an existing test and tests the same circumstances without a section controller `transitionDelegate` set. This causes all the logic to no-op and return the same instance of the original layout attributes object.

Differential Revision: D49900561

fbshipit-source-id: 8f768a998308c1aff73e8195aacdfd70579be601
2023-10-06 03:08:34 -07:00
Tim Oliver
97570b41d7 Remove unneeded interactive reordering test
Summary:
This was another test I originally added to test moving items belonging to sections containing only 1 item as this triggers the codepath to move the whole section.

It turns out this test isn't needed since the codepath is being properly tested in other tests.

Differential Revision: D49900555

fbshipit-source-id: f2586a22ef0f529fcfa10c4ef7d6d065a9a89f7d
2023-10-04 22:29:15 -07:00
Tim Oliver
46e0372aab Fix double item deletion test that started failing in Xcode 15
Summary:
I'm going through the IGListKit test suite with Xcode 15 and updating the tests that subsequently started failing with the new changes made to `UICollectionView` under the hood.

This was a test I originally added to help add to the code coverage, but it looks like my expectations about how it actually should work were incorrect, and it's now getting flagged by the new `UICollectionView` logic. I stepped through all the state with breakpoints and worked out how this is supposed to work.

Differential Revision: D49898019

fbshipit-source-id: fad21d14f0ae3a0ffbee8dde502114971f35fa1c
2023-10-04 22:29:15 -07:00
Tim Oliver
20190830ec Fix IGWarnAssert macro to remove unneeded condition parameter
Summary:
I'm looking at updating IGKitKit's test suite for Xcode 15, but when I went to do a build, it failed at the `IGWarnAssert` macro. Turns out that because we set the condition in the macro to always return `(NO)`, there's no need to expose `frmt` to test for the condition.

This diff removes `frmt` from the define, allowing the tests to build again.

Reviewed By: fabiomassimo

Differential Revision:
D49628618

Privacy Context Container: L1203725

fbshipit-source-id: b0456a149bf5be96c8401a21866880ccd72ebbcb
2023-09-26 08:22:26 -07:00
Fabio Milano
25d1887a41 Demote IGAssert for collection view delegate to warning
Summary: This are not critical enough to trigger an assertion instead of a warning.

Reviewed By: DimaVartanian

Differential Revision: D49326036

fbshipit-source-id: 50bbb6f57208ddea8cc1ead2db3b347f9e0c2f87
2023-09-15 14:14:11 -07:00
Krys Jurgowski
050cd8e670 Downgrade IGListKit assertion
Summary: This assertion has been firing for at least the [last 3 months](https://fburl.com/scuba/errorreporting_instagram_ios_assertions/vfxo4h2g) and we have shipped the app anyways so it is definitely not launch blocking.

Reviewed By: fabiomassimo

Differential Revision: D49281317

fbshipit-source-id: d525f88fe676e813b8413a2e0f21b6b12728b359
2023-09-15 12:20:12 -07:00
Tim Oliver
ffd51e6235 Enable using the invalidateLayout method in IGListCollectionViewLayout
Summary:
I noticed some strange behaviour in a collection view I was testing that was using `IGListCollectionView` and `IGListCollectionViewLayout`. Even if I called `invalidateLayout` on it, the cells wouldn't resize and would sometimes end up overflowing outside the collection view's bound.

I eventually managed to trace this back to `IGListCollectionViewLayout` that uses a `_minimumInvalidatedSection` flag to track when list content has changed before it starts calling the sizing logic of each section controller. While `invalidateLayoutWithContext:(IGListCollectionViewLayoutInvalidationContext *)context` was correctly setting this flag, `invalidateLayout` wasn't subclassed, and so this call was basically always falling through.

This diff configures `invalidateLayout` to set this flag, so when this method is called, it will correctly perform a new cell sizing pass.

Reviewed By: DimaVartanian

Differential Revision: D47787723

fbshipit-source-id: 724d76ba3e7b5c32b60e7c76347a129c30f0b502
2023-07-26 20:35:00 -07:00
Tim Oliver
e965f28515 Refine "Load More" view controller for iPad
Summary:
The "Tail Loading" example wasn't working correctly on some iPad variants as some of the screens were too large for the number of items in the collection.

This diff:
* Enables scroll bouncing regardless of content size
* Adds more items to the list on iPad to ensure it always has some scrollable height.
* Adds `invalidateLayout()` to view size changes in order to properly handle landscape/portrait rotations.
* Hides the disclosure chevron by default (Since only the Demos view controller when running on iPhone needs it)

Reviewed By: DimaVartanian

Differential Revision: D47662107

fbshipit-source-id: a9b2ee532a84b62a387685da09c5ea532eb2c874
2023-07-25 09:17:11 -07:00
Tim Oliver
71d06d54c1 Convert Demos to rounded group style
Summary: To demonstrate some more advanced UI customization with IGListKit, and to help make the sample app look more modern, this diff updates the root Demos view controller to adopt the 'grouped inset' style of lists that was introduced in iOS 13.

Reviewed By: DimaVartanian

Differential Revision: D47050305

fbshipit-source-id: e230bea3c98ecb9f547d4fb04b74f32efcb4d986
2023-07-25 09:17:11 -07:00
Tim Oliver
6ab6109779 Polish Demos view controller
Summary:
Adds additional polish and refinement to the initial Demos view controller.

* Adds SF Symbols to each section.
* Correctly selects and deselects cells when in and out split view mode.
* Fixes demo table view cell to adapt to safe area insets correctly.

Reviewed By: fabiomassimo

Differential Revision: D45686668

fbshipit-source-id: 5e24120a0aab5cb3fb9c33b0b0d7c087a56d6304
2023-07-19 22:08:21 -07:00
Tim Oliver
1e48bf9141 Add split mode to iPad
Summary: Updates the sample iOS app with `UISplitViewController` to enable split view functionality on iPad, and larger screen iPhones.

Reviewed By: fabiomassimo

Differential Revision: D45687142

fbshipit-source-id: 171cf7f3306b64db92216dded5c129fa15fd97b3
2023-07-19 22:08:21 -07:00
Tim Oliver
6f8c494060 Add iOS 11 large titles
Summary:
As part of the push for a new public release of IGListKit, I thought it'd be a good idea to go back, review the sample apps and provide some visual updates where possible. There are a lot of modern features of iOS and the other platforms that we can use to improve the look of the sample apps for free. 😁

For starters, this diff adds the standard iOS 11 large titles to the view controllers in the iOS sample app.

Reviewed By: fabiomassimo

Differential Revision: D45685793

fbshipit-source-id: f1846cfce32fb4945a6edf5e1a05c4cafd73dacc
2023-07-19 22:08:21 -07:00
Maxime Ollivier
cd3f84f227 fix crash when calling reloadObjects during an update
Summary:
Follow up to D47263265

## What's happening
We're calling `listAdapter.reloadObjects(...)` in the middle of the IGListKit's internal data update, so it's using the new section index path, instead of the old one. So we're going from a list of 2, insert at 0, and try to reload index 1, then we crash (it'll try to update index 2, which doesn't exist in the old array)

## Fix
Just like for `[IGListAdapter performBatchAnimated:updates:completion:]`, lets use the old index. To get this working, lets ask the updater if we're in an update, rather than `IGListAdapter` try to keep track of it.

Sorry the diff is a bit long, but in case this feels reasonable to pick, I might

Differential Revision: D47281472

fbshipit-source-id: 193153cfc15c87084b67f58c50e921db459d6800
2023-07-07 11:36:50 -07:00
Fabio Milano
dbda739b62 Log critical assert
Summary: Use `IGFailure` to log critical issues

Differential Revision:
D46029468

Privacy Context Container: L1132866

fbshipit-source-id: f642a50310e7a7d7a80e01ba61d382bb9a794496
2023-05-19 13:40:51 -07:00
Fabio Milano
dffcd4d0c8 Added new assertion level in IGListKit
Summary: Added new level of assertions for failures.

Differential Revision: D46029469

fbshipit-source-id: d8bd7ff41a19c15967e198c22aa5dc7b43972800
2023-05-19 13:40:51 -07:00
Fabio Milano
eb9b18ada4 Added try catch for NSInternalInconsistencyException in the update transaction
Summary: Added try catch for managing NSInternalInconsistencyException that are now tunneled through our assert flow

Differential Revision: D45995182

fbshipit-source-id: 829d2ea3122c1ed40e25c8da36d1926d27b42418
2023-05-18 13:26:26 -07:00
Tim Oliver
f4afe0d84a Delete .travis.yml
Summary:
At this point, I think we've migrated most, if not all of the equivalent pipelines from Travis CI over to GitHub Actions.

As part of preparing to launch v5.0, let's do some housecleaning and remove files that aren't being used anymore.

Differential Revision: D45476049

fbshipit-source-id: 423713d72870d20a2c3e0746b1d500e5d95b6340
2023-05-09 01:41:03 -07:00
Tim Oliver
c2cea36534 Update references to committed features in CHANGELOG
Summary: There were a lot of placeholder references to the PRs of committed features in the CHANGELOG. I went along each one and tagged each PR/commit that added the feature.

Differential Revision: D45477107

fbshipit-source-id: 4d64366bbafc07de278aaacac7e8558b6483cae4
2023-05-09 01:39:22 -07:00
ke.xu
164f39c4d4 Fix unsigned integer overflow (#1299)
Summary:
## Changes in this pull request

Issue fixed: #

### Checklist

- [ ] All tests pass. Demo project builds and runs.
- [ ] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1299

Reviewed By: m3rlin45

Differential Revision: D18703628

Pulled By: TimOliver

fbshipit-source-id: d347ed9c59c62ccdb73bd3abd14e289b7c06f3f6
2023-05-02 02:23:55 -07:00
Kent Sutherland
3cd3a111dd Update deployment targets to silence Xcode 14 warnings (#1573)
Summary:
## Changes in this pull request

Xcode 14 changed the minimum deployment target to iOS/tvOS 11.0 and macOS 10.13. This PR moves up the deployment targets so that a warning isn't shown on every build.

I also silenced the development region and base localization warnings.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/main/.github/CONTRIBUTING.md)

Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1573

Differential Revision: D45223095

Pulled By: TimOliver

fbshipit-source-id: 57fbd284809c09f86a9731d0676332de35fbe0df
2023-05-01 22:48:23 -07:00
Tim Oliver
f2b16b345e Add framework import check for IGListBindingSingleSectionController
Summary: One final tweak to IGListBindingSingleSectionController to ensure proper running with the sample apps on GitHub.

Reviewed By: m3rlin45

Differential Revision: D45170133

fbshipit-source-id: 8b48761962dee79a408cad2e9ffcc55a0fbd550e
2023-04-20 22:15:12 -07:00
Tim Oliver
bc83026985 Update IGListKit symlinks for SPM support
Summary: I ran the script needed to update the symlinks needed for SPM support. This removed the symlinks for the files we deleted and added the ones for `IGListBindingSingleSectionController`.

Reviewed By: candance

Differential Revision: D45147897

fbshipit-source-id: e3d351fcefd1f0e193aafc6f6c2af91fefb8c5cb
2023-04-20 14:26:11 -07:00
Tim Oliver
425cee4cef Split out checks for methods that throw
Summary:
I'm still not sure if there's an easier way to test throwing methods that work on both GitHub Actions and our internal build tooling (Since GitHub does throw at asserts, and our internal tools don't), but this way at least works.

Each statement has to be contained in its own separate `try` because the first throwing method will cancel execution in the rest of the code block.

This diff separates out each throwing test into its own `try` block

Reviewed By: candance

Differential Revision: D45147876

fbshipit-source-id: 95d587d5abe4a695b1ca1f76ebf3bda3984c6065
2023-04-20 14:26:11 -07:00
Tim Oliver
f66a0ae1e7 Add remaining test coverage for IGListBindingSingleSectionController
Summary: Adds additional tests to `IGListBindingSingleSectionControllerTests` to give `IGListBindingSingleSectionController` 100% code coverage

Reviewed By: candance

Differential Revision: D45147830

fbshipit-source-id: 0753888ab7f8058d72eb463f6444458bae65d964
2023-04-20 14:26:11 -07:00
Tim Oliver
d7206117a7 Add IGListBindingSingleSectionController to public headers
Summary:
While the `IGListBindingSingleSectionController` class and a nearly complete test suite were present in the IGListKit repo, they weren't imported into Xcode, and so they weren't part of the public release or the test CI.

Since the class looks like it's being used within Instagram, it's clear that it's not deprecated. I'm assuming it was added for a specific use-case in Instagram, and integrating it with the public Xcode project was still pending.

This diff integrates the class back into the public framework.

Reviewed By: candance

Differential Revision: D45147758

fbshipit-source-id: b0a84a2909635a4448480246f315243f4fcac134
2023-04-20 14:26:11 -07:00
Tim Oliver
b68ab60b92 Remove unused IGListExperimentalAdapterUpdater+DebugDescription.h header file
Summary: I found a file named `IGListExperimentalAdapterUpdater+DebugDescription.h` that wasn't part of the Xcode project, and had no accompanying implementation file. Since it looks like it's not being used, we can probably just delete it.

Reviewed By: candance

Differential Revision: D45147745

fbshipit-source-id: a1fbc0475c1c6098f03c7ea6a2f6316917c2e677
2023-04-20 14:26:11 -07:00
Tim Oliver
b09fc8c775 Add detached source files back to Xcode project
Summary:
I discovered after committing the last stack of diffs (especially after renaming `IGListReloadDataUpdaterTests`) that some of the other test files weren't included in IGListKit's Xcode project.

This diff updates the project file to include all of the previously unlinked test and source files.

Reviewed By: candance

Differential Revision: D45147042

fbshipit-source-id: 3141e15b7bc1d0431b6286f6d966e88bd8f88f2a
2023-04-20 14:26:11 -07:00
Tim Oliver
18287ef629 Omit the test suite from code coverage stats
Summary:
I realized halfway through this exercise that the code in the unit tests themselves was also getting counted in the final code coverage stats, and that this was artificially inflating the final number by a pretty big amount.

This diff omits the test suite from the coverage stats.

Reviewed By: candance

Differential Revision: D45022827

fbshipit-source-id: 45a043e70bcc053e07dbeefaa2e3da8a10a982db
2023-04-17 20:41:49 -07:00
Tim Oliver
b746af936d Added extra test case to IGTestDelegateController
Summary: Added making a call to the supplementary view data source in IGTestDelegateController so that codepath gets the same test exposure as the regular cell mechanism.

Reviewed By: candance

Differential Revision: D45004843

fbshipit-source-id: 6d3140ebc59da5ba4b7a151f6f104cdbd63418c2
2023-04-17 20:41:49 -07:00
Tim Oliver
bec019925c Added remaining test coverage for IGListSectionMap
Summary: Added remaining test coverage to IGListSectionMap

Reviewed By: candance

Differential Revision: D45004860

fbshipit-source-id: 30e4988a8b3ce56551aceb52c0cd99be2286fffa
2023-04-17 20:41:49 -07:00
Tim Oliver
d7574152d3 Add test coverage for list adapter debugger class
Summary: Adds additional functionality and coverage testing to the adapter debugger class

Reviewed By: candance

Differential Revision: D45004651

fbshipit-source-id: 40330f5f2fed2946cc5ead89b30cf4030b596b65
2023-04-17 20:41:49 -07:00
Tim Oliver
7d9ccfc9ea Added test coverage to collection view and collection view layout
Summary: Adds additional test coverage to the collection view and collection view layout test suites

Reviewed By: candance

Differential Revision: D45004591

fbshipit-source-id: 21587df6f9595cb54481067322aae6443e089152
2023-04-17 20:41:49 -07:00
Tim Oliver
97120d288d Added remaining test coverage to IGListBindingSectionController
Summary: Added remaining test cases to cover `IGListBindingSectionController`

Reviewed By: candance

Differential Revision: D45004640

fbshipit-source-id: 2dd1662af849841ab5dccc1f6731ddac800657a0
2023-04-17 20:41:49 -07:00
Tim Oliver
2b0ca81c0b Added more coverage cases to list adapter tests
Summary: I reenabled a couple of tests that had previously been marked disabled, but work properly now, and I added additional tests to cover some of the coverage cases that had previously been missed.

Reviewed By: candance

Differential Revision: D45004625

fbshipit-source-id: dacf49b2f0f420f269e3071ad4fc76762c95365c
2023-04-17 20:41:49 -07:00
Tim Oliver
1bc993381c Reenable some disabled tests in list adapter E2E tests
Summary:
There were several tests in the E2E test suite that had been deliberately disabled. I reenabled them and tested them, and they all passed correctly.

I've left them reenabled in this diff, but we can disable them down the line again if they start to fail again.

Differential Revision: D45004373

fbshipit-source-id: c0bc96e1d364d702d12e945059daedf2ae21cfa5
2023-04-17 20:41:49 -07:00
Tim Oliver
95e19a1430 Renamed IGReloadDataUpdaterTests to IGListReloadDataUpdaterTests
Summary: This diff renames `IGReloadDataUpdaterTests` to `IGListReloadDataUpdaterTests` to be consistent with the naming scheme of the other classes

Differential Revision: D45004236

fbshipit-source-id: 8ecc2ca60740ff6cca1028400621a22c7b1d3406
2023-04-17 20:41:49 -07:00
Tim Oliver
965025d2d3 Add new test files to IGListKit
Summary: This diff adds several new test classes to IGListKit's test suite, covering a variety of objects and use cases that weren't covered before.

Reviewed By: candance

Differential Revision: D45004015

fbshipit-source-id: 5e6cc3f56e62328173657c09c955c320e6067936
2023-04-17 20:41:49 -07:00
Tim Oliver
08a1d83652 Refactor code syntax in internal classes to be easier to provide code coverage
Summary: Similar to the previous diff, this diff updates some of the code styling and syntax in IGListKit's internal classes to make it much easier to provide test coverage to each method in there.

Reviewed By: candance

Differential Revision: D45003471

fbshipit-source-id: 1267901fc7a917bf1c30783654a8fd0da941bff1
2023-04-17 20:41:49 -07:00
Tim Oliver
dfb52ea701 Refactor code syntax in public classes to be easier to provide code coverage
Summary:
While testing the existing code coverage, I discovered several code patterns in some of IGListKit's public classes that were literally impossible to cover. These included things like bailing out of blocks when `weakSelf` is `nil`, or exiting early inside `switch` statements.

This diff reimplements some of the existing logic in several of the public facing IGListKit classes, so that all of these classes can be 100% covered by unit tests.

Reviewed By: candance

Differential Revision: D45002889

fbshipit-source-id: 6b87ea6338b9f33bed7955d6cc797d116b533085
2023-04-17 20:41:49 -07:00
Tim Oliver
610c6d2ba8 Remove unused IGListBatchUpdates class from IGListKit
Summary:
While auditing all of the classes in IGListKit, I discovered that `IGListBatchUpdates` is completely unused. It looks like in the documentation that a new class was introduced to replace it, and it looks like this transition has already completed.

Since it doesn't make sense to cover an unused class, let's delete it. :)

Differential Revision: D45002736

fbshipit-source-id: 45e39f37bf00dc6c4867e9df49cfdfce1252604f
2023-04-17 20:41:49 -07:00
Tim Oliver
ceda03a0e1 Bring IGListDiffKit test coverage to 100%
Summary: Fills in the remaining gaps in the tests in order to bring the code coverage of IGListDiffKit (ie, the diffing engine portion of IGListKit) up to 100%.

Differential Revision: D45002512

fbshipit-source-id: b4795946400f7e5ead8882b5d0f5003fb1d17aed
2023-04-17 20:41:49 -07:00
Tim Oliver
324e853468 Update build environment to latest OS versions
Summary:
Our CI harness for IGListKit on GitHub recently started to consistently fail at the unit test phase (https://github.com/Instagram/IGListKit/actions/runs/4683650178/jobs/8298963444).

After researching it, it looks like GitHub Actions changed some configurations with their older versions of macOS, and our existing build script no longer seems to be working now. The build output seems to imply that Xcode simply hangs when it gets to the testing phase.

I decided to take this chance to do a thorough audit of all our build steps and update as many of the dependencies as I could to their latest versions. This has fixed the issue, and hopefully given us a decent amount of future-proofing at the same time. :)

Reviewed By: candance

Differential Revision: D45002141

fbshipit-source-id: 40b22da4a9282900ff299b5e41f3a8566c4071f0
2023-04-17 20:41:49 -07:00