chore: cleanup tests
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									a2e02890a0
								
							
						
					
					
						commit
						9a42503205
					
				| @ -16,63 +16,54 @@ describe('getInputList', () => { | ||||
|   it('single line correctly', async () => { | ||||
|     await setInput('foo', 'bar'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar']); | ||||
|   }); | ||||
| 
 | ||||
|   it('multiline correctly', async () => { | ||||
|     setInput('foo', 'bar\nbaz'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz']); | ||||
|   }); | ||||
| 
 | ||||
|   it('empty lines correctly', async () => { | ||||
|     setInput('foo', 'bar\n\nbaz'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz']); | ||||
|   }); | ||||
| 
 | ||||
|   it('comma correctly', async () => { | ||||
|     setInput('foo', 'bar,baz'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz']); | ||||
|   }); | ||||
| 
 | ||||
|   it('empty result correctly', async () => { | ||||
|     setInput('foo', 'bar,baz,'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz']); | ||||
|   }); | ||||
| 
 | ||||
|   it('different new lines correctly', async () => { | ||||
|     setInput('foo', 'bar\r\nbaz'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz']); | ||||
|   }); | ||||
| 
 | ||||
|   it('different new lines and comma correctly', async () => { | ||||
|     setInput('foo', 'bar\r\nbaz,bat'); | ||||
|     const res = await context.getInputList('foo'); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['bar', 'baz', 'bat']); | ||||
|   }); | ||||
| 
 | ||||
|   it('multiline and ignoring comma correctly', async () => { | ||||
|     setInput('cache-from', 'user/app:cache\ntype=local,src=path/to/dir'); | ||||
|     const res = await context.getInputList('cache-from', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']); | ||||
|   }); | ||||
| 
 | ||||
|   it('different new lines and ignoring comma correctly', async () => { | ||||
|     setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir'); | ||||
|     const res = await context.getInputList('cache-from', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']); | ||||
|   }); | ||||
| 
 | ||||
| @ -86,7 +77,6 @@ ccccccccc" | ||||
| FOO=bar` | ||||
|     ); | ||||
|     const res = await context.getInputList('secrets', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual([ | ||||
|       'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', | ||||
|       `MYSECRET=aaaaaaaa
 | ||||
| @ -110,7 +100,6 @@ bbbb | ||||
| ccc"` | ||||
|     ); | ||||
|     const res = await context.getInputList('secrets', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual([ | ||||
|       'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', | ||||
|       `MYSECRET=aaaaaaaa
 | ||||
| @ -134,7 +123,6 @@ ccccccccc | ||||
| FOO=bar` | ||||
|     ); | ||||
|     const res = await context.getInputList('secrets', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']); | ||||
|   }); | ||||
| 
 | ||||
| @ -148,7 +136,6 @@ ccccccccc" | ||||
| FOO=bar` | ||||
|     ); | ||||
|     const res = await context.getInputList('secrets', true); | ||||
|     console.log(res); | ||||
|     expect(res).toEqual([ | ||||
|       'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', | ||||
|       `MYSECRET=aaaaaaaa
 | ||||
|  | ||||
| @ -168,7 +168,6 @@ describe('transform', () => { | ||||
|   ])('given %p attributes ', async (inputs: string[], expected: Flavor, invalid: boolean) => { | ||||
|     try { | ||||
|       const flavor = Transform(inputs); | ||||
|       console.log(flavor); | ||||
|       expect(flavor).toEqual(expected); | ||||
|     } catch (err) { | ||||
|       if (!invalid) { | ||||
|  | ||||
| @ -8,7 +8,6 @@ jest.spyOn(github, 'repo').mockImplementation((): Promise<github.ReposGetRespons | ||||
| describe('repo', () => { | ||||
|   it('returns GitHub repository', async () => { | ||||
|     const repo = await github.repo(process.env.GITHUB_TOKEN || ''); | ||||
|     console.log(repo); | ||||
|     expect(repo.name).not.toBeNull(); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| @ -34,21 +34,17 @@ beforeEach(() => { | ||||
| const tagsLabelsTest = async (name: string, envFile: string, inputs: Inputs, exVersion: Version, exTags: Array<string>, exLabels: Array<string>) => { | ||||
|   process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile))); | ||||
|   const context = github.context(); | ||||
|   console.log(process.env, context); | ||||
| 
 | ||||
|   const repo = await github.repo(process.env.GITHUB_TOKEN || ''); | ||||
|   const meta = new Meta({...getInputs(), ...inputs}, context, repo); | ||||
| 
 | ||||
|   const version = meta.version; | ||||
|   console.log('version', version); | ||||
|   expect(version).toEqual(exVersion); | ||||
| 
 | ||||
|   const tags = meta.getTags(); | ||||
|   console.log('tags', tags); | ||||
|   expect(tags).toEqual(exTags); | ||||
| 
 | ||||
|   const labels = meta.getLabels(); | ||||
|   console.log('labels', labels); | ||||
|   expect(labels).toEqual(exLabels); | ||||
| }; | ||||
| 
 | ||||
| @ -3152,13 +3148,11 @@ describe('json', () => { | ||||
|   ])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exJSON: {}) => { | ||||
|     process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile))); | ||||
|     const context = github.context(); | ||||
|     console.log(process.env, context); | ||||
| 
 | ||||
|     const repo = await github.repo(process.env.GITHUB_TOKEN || ''); | ||||
|     const meta = new Meta({...getInputs(), ...inputs}, context, repo); | ||||
| 
 | ||||
|     const jsonOutput = meta.getJSON(); | ||||
|     console.log('json', jsonOutput); | ||||
|     expect(jsonOutput).toEqual(exJSON); | ||||
|   }); | ||||
| }); | ||||
| @ -3459,13 +3453,11 @@ describe('bake', () => { | ||||
|   ])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, exBakeDefinition: {}) => { | ||||
|     process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile))); | ||||
|     const context = github.context(); | ||||
|     console.log(process.env, context); | ||||
| 
 | ||||
|     const repo = await github.repo(process.env.GITHUB_TOKEN || ''); | ||||
|     const meta = new Meta({...getInputs(), ...inputs}, context, repo); | ||||
| 
 | ||||
|     const bakeFile = meta.getBakeFile(); | ||||
|     console.log('bakeFile', bakeFile, fs.readFileSync(bakeFile, 'utf8')); | ||||
|     expect(JSON.parse(fs.readFileSync(bakeFile, 'utf8'))).toEqual(exBakeDefinition); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| @ -99,7 +99,6 @@ describe('transform', () => { | ||||
|   ])('given %p', async (l: string[], expected: Tag[], invalid: boolean) => { | ||||
|     try { | ||||
|       const tags = Transform(l); | ||||
|       console.log(tags); | ||||
|       expect(tags).toEqual(expected); | ||||
|     } catch (err) { | ||||
|       if (!invalid) { | ||||
| @ -429,7 +428,6 @@ describe('parse', () => { | ||||
|   ])('given %p event ', async (s: string, expected: Tag, invalid: boolean) => { | ||||
|     try { | ||||
|       const tag = Parse(s); | ||||
|       console.log(tag); | ||||
|       expect(tag).toEqual(expected); | ||||
|     } catch (err) { | ||||
|       if (!invalid) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 CrazyMax
						CrazyMax