Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Merge #640
Browse files Browse the repository at this point in the history
640: refactor: fixed for the issue (#639) r=myConsciousness a=myConsciousness

# 1. Description

<!-- Provide a description of what this PR is doing.
If you're modifying existing behavior, describe the existing behavior, how this PR is changing it,
and what motivated the change. If this is a breaking change, specify explicitly which APIs have been
changed. -->

## 1.1. Checklist

<!-- Before you create this PR confirm that it meets all requirements listed below by checking the
relevant checkboxes (`[x]`). This will ensure a smooth and quick review process. -->

- [x] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc).
- [x] I have read the [Contributor Guide] and followed the process outlined for submitting PRs.
- [x] I have updated/added tests for ALL new/updated/fixed functionality.
- [x] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`.
- [x] I have updated/added relevant examples in `examples`.

## 1.2. Breaking Change

<!-- Does your PR require users to manually update their apps to accommodate your change?

If the PR is a breaking change this should be indicated with suffix "!"  (for example, `feat!:`, `fix!:`). See [Conventional Commit] for details.
-->

- [ ] Yes, this is a breaking change.
- [x] No, this is _not_ a breaking change.

## 1.3. Related Issues

<!-- Provide a list of issues related to this PR from the [issue database].
Indicate which of these issues are resolved or fixed by this PR, i.e. Fixes #xxxx* !-->

<!-- Links -->

[issue database]: https://github.com/twitter-dart/twitter-api-v2/issues
[contributor guide]: https://github.com/twitter-dart/twitter-api-v2/blob/main/CONTRIBUTING.md
[style guide]: https://github.com/twitter-dart/twitter-api-v2/blob/main/STYLEGUIDE.md
[conventional commit]: https://conventionalcommits.org


Co-authored-by: myConsciousness <contact@shinyakato.dev>
  • Loading branch information
bors[bot] and myConsciousness authored Jan 25, 2023
2 parents 6abe0a3 + fb870ac commit c91e638
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v4.8.2

- Added `valueOf` method in Enum objects. You can convert from a string returned from the API to an Enum. ([#635](https://github.com/twitter-dart/twitter-api-v2/issues/635))
- Added `HttpStatus`, `headers`, and `request` to response information. ([#637](https://github.com/twitter-dart/twitter-api-v2/issues/637))

## v4.8.1

Expand Down
8 changes: 4 additions & 4 deletions lib/src/service/tweets/decahose_partition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// modification, are permitted provided the conditions.

enum DecahosePartition {
section1(1),
section2(2);
section1('1'),
section2('2');

/// The partition value.
final int value;
final String value;

static DecahosePartition valueOf(final String value) {
for (final element in values) {
if (element.value.toString() == value) {
if (element.value == value) {
return element;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/src/service/tweets/decahose_partition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ void main() {
});

test('.value', () {
expect(DecahosePartition.section1.value, 1);
expect(DecahosePartition.section2.value, 2);
expect(DecahosePartition.section1.value, '1');
expect(DecahosePartition.section2.value, '2');
});

group('.valueOf', () {
Expand All @@ -25,7 +25,7 @@ void main() {
});

test('when value is unsupported', () {
expect(() => DecahosePartition.valueOf('test'),
expect(() => DecahosePartition.valueOf('0'),
throwsA(isA<UnsupportedError>()));
});
});
Expand Down

0 comments on commit c91e638

Please sign in to comment.