-
Notifications
You must be signed in to change notification settings - Fork 305
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
Conversation
👷 Deploy request for slash-libraries pending review.Visit the deploys page to approve it
|
packages/common/storage/src/typed/storages/NumberTypedStorage.ts
Outdated
Show resolved
Hide resolved
@@ -2,13 +2,13 @@ | |||
import { TypedStorage } from './TypedStorage'; | |||
|
|||
export class NumberTypedStorage extends TypedStorage<number> { | |||
public increase(): void { | |||
public increase(offset = 1): void { |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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', () => { |
There was a problem hiding this comment.
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.', () => { |
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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.', () => { |
There was a problem hiding this comment.
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', () => {
...
});
});
…k-Tech/slash into feat-storage-number
@hoseungjang thank you for your sophisticated translation😁 |
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