-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5eb5f8
commit a7a2231
Showing
7 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { IReaderConfiguration } from '../../models'; | ||
import { Ean13Reader } from '../../readers'; | ||
|
||
describe('Ean13Reader', () => { | ||
const config = {} as IReaderConfiguration; | ||
let classUnderTest: Ean13Reader; | ||
|
||
beforeEach(() => { | ||
classUnderTest = new Ean13Reader(config); | ||
}); | ||
|
||
describe('validate', () => { | ||
test('should validate value length', () => { | ||
/* tslint:disable */ | ||
expect(classUnderTest['validate'](']E41111111111111')).toBe(true); | ||
expect(classUnderTest['validate'](']E411111111111111')).toBe(false); | ||
expect(classUnderTest['validate'](']E411111')).toBe(false); | ||
/* tslint:enable */ | ||
}); | ||
|
||
test('should validate character type', () => { | ||
/* tslint:disable */ | ||
expect(classUnderTest['validate'](']E41111111111111')).toBe(true); | ||
expect(classUnderTest['validate'](']E4aaaaaaaaaaaaa')).toBe(false); | ||
/* tslint:enable */ | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { IReaderConfiguration } from '../../models'; | ||
import { Ean8Reader } from '../../readers'; | ||
|
||
describe('Ean8Reader', () => { | ||
const config = {} as IReaderConfiguration; | ||
let classUnderTest: Ean8Reader; | ||
|
||
beforeEach(() => { | ||
classUnderTest = new Ean8Reader(config); | ||
}); | ||
|
||
describe('validate', () => { | ||
test('should validate value length', () => { | ||
/* tslint:disable */ | ||
expect(classUnderTest['validate'](']E411111111')).toBe(true); | ||
expect(classUnderTest['validate'](']E411111111111111')).toBe(false); | ||
expect(classUnderTest['validate'](']E411111')).toBe(false); | ||
/* tslint:enable */ | ||
}); | ||
|
||
test('should validate character type', () => { | ||
/* tslint:disable */ | ||
expect(classUnderTest['validate'](']E411111111')).toBe(true); | ||
expect(classUnderTest['validate'](']E4aaaaaaaa')).toBe(false); | ||
/* tslint:enable */ | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ export enum AimCodes { | |
ITF = ']I0', | ||
CODE39 = ']A0', | ||
CODE128 = ']C0', | ||
EAN13 = ']E4', | ||
EAN8 = ']E0', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IReaderConfiguration } from '../models'; | ||
import { BaseGtinReader } from './base-gtin.reader'; | ||
import { Symbologies } from '../config'; | ||
|
||
const REG: RegExp = /^\]E0[0-9]{13,13}$/; | ||
|
||
export class Ean13Reader extends BaseGtinReader { | ||
constructor(readerConfig?: IReaderConfiguration) { | ||
super(Symbologies.GTIN13, REG, readerConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IReaderConfiguration } from '../models'; | ||
import { BaseGtinReader } from './base-gtin.reader'; | ||
import { Symbologies } from '../config'; | ||
|
||
const REG: RegExp = /^\]E4[0-9]{8,8}$/; | ||
|
||
export class Ean8Reader extends BaseGtinReader { | ||
constructor(readerConfig?: IReaderConfiguration) { | ||
super(Symbologies.GTIN8, REG, readerConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters