Skip to content

feat(@toss/storage): Gave scalability to two methods of NumberTypedStorage. #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 5, 2023

Conversation

okinawaa
Copy link
Member

Overview

Building an application, you might want to increase and decrease the number as much as you want, instead of adjusting the number one by one.
In that case, two methods(increase, decrease) were modified to receive argument.

PR Checklist

  • I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

@netlify
Copy link

netlify bot commented Jan 31, 2023

👷 Deploy request for slash-libraries pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 77c4a9f

@@ -2,13 +2,13 @@
import { TypedStorage } from './TypedStorage';

export class NumberTypedStorage extends TypedStorage<number> {
public increase(): void {
public increase(offset = 1): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please specify the type of offset.

public increase(offset: number = 1): void;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good that it's explicit! but it is ok to ignore line warning?

image

const typed = new NumberTypedStorage('increase-test', { initialValue: 10 });
describe('NumberTypedStorage', () => {
describe('increase() method', () => {
it('should increase the value of the given key by 1. when given no argument', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe('when there is no given offset', () => {
  it('should increase the value of the given key by 1', () => {
    ...
  });
});

typed.increase();
expect(typed.get()).toBe(11);
});
it('should increase the value of the given key by argument.', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe('when there is given offset', () => {
  it('should increase the value of the given key by offset', () => {
    ...
  });
});

it('주어진 key의 값을 1 감소시킨다.', () => {
const typed = new NumberTypedStorage('decrease-test', { initialValue: 10 });
describe('decrease() method', () => {
it('should decrease the value of the given key by 1. when given no argument', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe('when there is no given offset', () => {
  it('should decrease the value of the given key by 1', () => {
    ...
  });
});

typed.decrease();
expect(typed.get()).toBe(9);
});
it('should decrease the value of the given key by argument.', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

describe('when there is given offset', () => {
  it('should decrease the value of the given key by offset', () => {
    ...
  });
});

@okinawaa
Copy link
Member Author

okinawaa commented Feb 2, 2023

@hoseungjang thank you for your sophisticated translation😁

@okinawaa okinawaa requested a review from hoseungme February 2, 2023 16:54
@hoseungme hoseungme merged commit 859a5c3 into toss:main Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants